Skip to content

Instantly share code, notes, and snippets.

View binalfew's full-sized avatar

Binalfew Kassa binalfew

  • Vintage Solutions
  • Addis Ababa, Ethiopia
  • X @binalfew
View GitHub Profile
@binalfew
binalfew / machine.js
Created December 6, 2022 07:39
Generated by XState Viz: https://xstate.js.org/viz
const fetchMachine = Machine({
id: 'fetch',
initial: 'idle',
context: {
retries: 0
},
states: {
idle: {
on: {
FETCH: 'loading'
@binalfew
binalfew / machine.js
Last active December 5, 2022 22:36
Generated by XState Viz: https://xstate.js.org/viz
const stopLightMachine = Machine({
id: 'stoplight',
initial: 'red',
context: {
rushHourMultiplier: 1
},
on: {
INC_RUSH_HOUR: {
actions: ['incRushHour']
}
@binalfew
binalfew / machine.js
Last active December 5, 2022 22:04
Generated by XState Viz: https://xstate.js.org/viz
const heater = Machine({
id: 'heater',
initial: 'poweredOff',
states: {
poweredOff: {
on: {
TOGGLE_POWER: 'poweredOn.hist',
},
},
poweredOn: {
@binalfew
binalfew / machine.js
Last active December 5, 2022 21:42
Generated by XState Viz: https://xstate.js.org/viz
const door = Machine({
id: 'door',
initial: 'locked',
states: {
locked: {
id: 'locked',
on: {
UNLOCK: 'unlocked',
},
},
@binalfew
binalfew / machine.js
Last active December 5, 2022 21:25
Generated by XState Viz: https://xstate.js.org/viz
const vendingMachine = Machine(
{
id: 'vendingMachine',
initial: 'idle',
context: {
deposited: 0,
},
states: {
idle: {
on: {
@binalfew
binalfew / machine.js
Last active December 5, 2022 21:09
Generated by XState Viz: https://xstate.js.org/viz
const alarmClock = Machine({
id: 'alarmClock',
initial: 'idle',
states: {
idle: {
on: {
ALARM: 'alarming'
}
},
alarming: {
@binalfew
binalfew / machine.js
Created December 5, 2022 20:46
Generated by XState Viz: https://xstate.js.org/viz
const echoMachine = Machine({
id: 'echo',
initial: 'listening',
states: {
listening: {
on: {
SPEAK: {
actions: send({type: 'ECHO'})
},
@binalfew
binalfew / machine.js
Last active December 5, 2022 20:41
Generated by XState Viz: https://xstate.js.org/viz
const lightBulbMachine = Machine( {
id: 'lightBulb',
initial: 'unlit',
states: {
lit: {
exit: () => {
console.log('it is so dark and cold');
},
on: {
BREAK: {
@binalfew
binalfew / machine.js
Created November 11, 2022 05:34
Generated by XState Viz: https://xstate.js.org/viz
const doorMachine = Machine({
id: 'doorMachine',
initial: 'locked',
states: {
locked: {
id: 'locked',
on: {
UNLOCK: 'unlocked'
}
},
@binalfew
binalfew / WindowsTerminal.md
Created January 17, 2021 17:51 — forked from dahlsailrunner/WindowsTerminal.md
Customization and Setup notes for Windows Terminal