David K. 🎹

David K. 🎹

@davidkpiano.bsky.social

State machine. Building stately.ai

8,856 Followers 116 Following 34 Posts Joined Apr 2023
1 month ago

The "you're falling behind on AI" crowd is weird. The whole point of this tech is that things get 10x easier, not harder.

Complicated agent/prompting patterns get replaced by better models, simpler patterns, and plug-and-play tools. Catching up takes a day, not months.

65 1 5 1
1 month ago

There is now!

4 0 0 0
5 months ago
Video thumbnail

🧩 Code Puzzle, a little side project I made. Each level gives you a JS snippet split into pieces. Arrange them in the right order with drag and drop to solve the puzzle.

➑️ code-puzzle.sandroroth.com

Built with #React and #XState

6 1 0 0
6 months ago

Whoa

6 0 0 0
6 months ago
Preview
CSS Elevator: A Pure CSS State Machine With Floor Navigation | CSS-Tricks In this article, author Chris Sabourin walk through how modern CSS features can build a fully functional, interactive elevator that knows where it is, where it’s headed, and how long it’ll take to get...

A dash of modern CSS accomplishes so many things that used to require abstractions, dependencies, and tricks (wink, wink).

This one from Christian Sabourin is a great example: custom properties, clamp()-ing, calc()-ing, counters, relational pseudo selectors, etc.

css-tricks.com/css-elevator...

14 2 0 1
7 months ago
Preview
Build the Future of AI-Native UX in 4 Hours | Web Dev Challenge Season 2 How will websites evolve if it's all powered by AI?

the latest Web Dev Challenge is available to everyone!

@algolia.bsky.social asked 3 teams of devs to imagine what the UX of an AI-native web app might look like. featuring @davidkpiano.bsky.social, @shaw.city, Nadirah, @aguywhocodes.com, Syscily, and Camille, with @chuckm.bsky.social

13 7 0 2
7 months ago
Preview
Build the Future of AI-Native UX in 4 Hours | Web Dev Challenge Season 2 How will websites evolve if it's all powered by AI?

new Web Dev Challege is up early for supporters!

watch Syscily, Camille, Nadirah, @aguywhocodes.com, @shaw.city, and @davidkpiano.bsky.social as they imagine what UX might look like in an AI-native app, sponsored by @algolia.bsky.social with @chuckm.bsky.social as our advisor

codetv.link/wdc/s2e6

13 3 1 1
8 months ago
Stephen and David of the Keyframers working at desks in CodeTV Studio

helping the Keyframers reunion happen over here @davidkpiano.bsky.social @shaw.city

29 3 4 1
9 months ago

Great to hear! Open to any suggestions or ideas

2 0 0 0
10 months ago

Yes it does! Since stores are atoms, you can combine/derive state from stores and other atoms.

In the future, atoms can be used inside store context reactively.

1 0 1 0
10 months ago

Yes, like Zustand and Jotai combined, but framework agnostic

2 0 1 0
10 months ago
// Regular atoms
const countAtom = createAtom(1);
countAtom.get(); // 1
const flavorAtom = createAtom('chocolate');

// Derived atom that combines both
const donutMessageAtom = createAtom(() => {
  const count = countAtom.get();
  const flavor = flavorAtom.get();
  return `${count} ${flavor} donut${count === 1 ? '' : 's'}`;
});

console.log(donutMessageAtom.get()); // "1 chocolate donut"

countAtom.set(3);
console.log(donutMessageAtom.get()); // "3 chocolate donuts"

flavorAtom.set('strawberry');
console.log(donutMessageAtom.get()); // "3 strawberry donuts" import { createAsyncAtom } from '@xstate/store';

const donutOrderAtom = createAsyncAtom(async () => {
  const order = { flavor: 'glazed', quantity: 12 };
  const data = await submitDonutOrder(order);
  return data;
});

donutOrderAtom.subscribe((state) => {
  if (state.status === 'pending') {
    console.log('🧾 Placing your order...');
  } else if (state.status === 'done') {
    console.log('🍩', state.data);
  } else if (state.status === 'error') {
    console.log('😒 Order failed:', state.error);
  }
});

βš›οΈ XState Store now has atoms, and they're *really* simple.

β†’ atom.get()
β†’ atom.set(…)
β†’ Derived atoms (reactive)
β†’ Async atoms
β†’ Stores are atoms too!

npm i @xstate/store

stately.ai/docs/xstate-...

33 7 1 0
1 year ago
@xstate/store | Stately Version 3.x (Version 2.x docs)

Yes, there's a guide here:

stately.ai/docs/xstate-...

May even make a codemod πŸ€”

2 0 1 0
1 year ago

XState Store!

0 0 1 0
1 year ago

I like state machines. I still struggle a bit to get my mind bent into state machine shape, but I’m always so happy with the quality of what I build when I do

79 2 5 0
1 year ago

Fixing that soon!

3 0 0 0
1 year ago

That's it, I'm switching to xstate store

65 3 6 1
1 year ago

How would you simplify XState?

Planning for the next major version, and would love to hear your thoughts and ideas ✍️

18 1 7 0
1 year ago

Would love to hear your ideas!

0 0 0 0
1 year ago
The Angular+ Show logo. S8E811. β€œState Machines and XState in Angular with David Khourshid. Hosts  Q, Lara Newsom, Jan-Niklas Vortmann, Chau Tran and Brian Love."  Photos of the hosts. Photo of David .

Join us on today's episode as we interview David Khourshid @davidkpiano.bsky.social. We will learn about state machines and how XState plays nice with #Angular right out of the box! #ngconf
🍎https://apple.co/4ipNHcP
🟒 spoti.fi/3VxlGGq

8 3 0 0
1 year ago

I now *really* enjoy reading articles that are so obviously human-written, mistakes and all

148 2 6 1
1 year ago

I'd love to! Next year.

7 0 2 0
1 year ago

I don't like default exports.

They exist in JS because they're "simpler", even though they're more verbose:

export default Thing
import Thing from './thing'

vs.

export { Thing }
import { Thing } from './thing'

Just use consistent naming & don't be afraid of typing curly braces.

81 8 12 0
1 year ago
Video thumbnail

Updated demo of Decode generating state-machines from diagrams, this time with streaming generation support

Then I do the reverse, generating a diagram from an implementation.

The diagram auto-layout is still rough. I'll work work on more robust auto-layout soon.

32 6 3 0
1 year ago

This is incredible

1 0 1 0
1 year ago

πŸ”² Merge Conflict: Accept All Current
πŸ”² Merge Conflict: Accept All Incoming
β˜‘οΈ Merge Conflict: Accept the things I cannot change, the courage to change the things I can, and the wisdom to know the difference

161 18 4 1
1 year ago
Preview
How to Grow Professional Relationships A practical, science-backed model for growing quality professional relationships.

I wrote an essay about relationships that may be helpful for personal career development (and maybe devrel).

Mentioned in the post (by name): @davidkpiano.bsky.social, @kentcdodds.com, @joshuakgoldberg.com, @jennytru.bsky.social, @acemarke.dev, and others

tej.as/blog/how-to-...

41 8 0 0
1 year ago

I love it

2 0 0 0
1 year ago

2025?

3 0 0 0
1 year ago

Component State Management in React:
- useState
- useMachine

That's it. That's all I use anymore.

53 4 9 2