Skip to content

Instantly share code, notes, and snippets.

View farskid's full-sized avatar
🎯
Focusing

Farzad Yousefzadeh farskid

🎯
Focusing
View GitHub Profile
@farskid
farskid / test.md
Created April 17, 2023 17:12
test
stateDiagram-v2
  state "form input
      entry: a, b" as form%20input
  state form%20input {
    state "active
      entry: enableInput
      exit: blah blah" as machine.active
    state "disabled
      entry: disableInput
@farskid
farskid / TreeIterator.js
Created June 10, 2022 19:46 — forked from sonyseng/TreeIterator.js
Playing around with the Iterators from ES6 to walk a tree non-recursively (babeljs)
// Test tree with contrived data
let testTree = {
value: 1,
child: [
{value: 2, child: [
{value: 7, child: []},
{value: 8, child: []},
{value: 9, child: []},
]},
{value: 3, child: []},
@farskid
farskid / stepForm.js
Last active September 30, 2021 19:18 — forked from waldothedeveloper/stepForm.js
Step Online Form
import { createMachine, assign } from "xstate"
import {
zipCodeRegex,
verifyZipcode,
formatPhoneNumber,
validatePhoneNumber,
} from "../../utils/quiz_form_validation"
//
export const stepMachine = createMachine(
@farskid
farskid / machine.js
Last active August 5, 2021 16:16
Generated by XState Viz: https://xstate.js.org/viz
Machine({
initial: 'a',
// leaving a syntax error deliberately here
states:
a: {}
}
})
@farskid
farskid / machine.js
Created July 29, 2021 10:48
Generated by XState Viz: https://xstate.js.org/viz
const fileMachine = Machine({
id: "file",
type: "parallel",
states: {
upload: {
initial: "idle",
states: {
idle: {
@farskid
farskid / machine.js
Created July 27, 2021 16:11
Generated by XState Viz: https://xstate.js.org/viz
const fileMachine = Machine({
id: "file",
type: "parallel",
states: {
upload: {
initial: "idle",
states: {
idle: {
@farskid
farskid / machine.js
Created July 4, 2021 19:22
Generated by XState Viz: https://xstate.js.org/viz
const editorPanelMachine = Machine({
context: {immediateUpdate: true},
initial: 'booting',
states: {
booting: {},
active: {},
updating: {
entry: send('UPDATE_MACHINE_PRESSED'),
always: 'active',
},
@farskid
farskid / machine.js
Created June 29, 2021 09:32
Generated by XState Viz: https://xstate.js.org/viz
Machine({
initial: 'a',
context: {}, // enable this for the machine to work
states: {
a: {
entry: assign({id: 1}),
on: {
'': [
{target: 'with_id', cond: ctx => !!ctx.id},
'no_id'
@farskid
farskid / machine.js
Last active June 29, 2021 20:26
Generated by XState Viz: https://xstate.js.org/viz
Machine({
id: 'a',
initial: 'checking_url',
context: {gistID: null, gistRawContent: null},
states: {
checking_url: {
entry: 'parseQueries',
always: [
{ target: 'with_gist', cond: 'isGistIDAvailable' },
{ target: 'no_gist' }
@farskid
farskid / machine.js
Last active June 26, 2021 09:05
Generated by XState Viz: https://xstate.js.org/viz
Machine({
id: 'test',
initial: 'a',
states: {a: {
entry: ['t']
}}
}, {
actions: {
t: () => console.log('hello')
}