Skip to content

Instantly share code, notes, and snippets.

View hrafnkellpalsson's full-sized avatar

Hrafnkell Pálsson hrafnkellpalsson

View GitHub Profile
@hrafnkellpalsson
hrafnkellpalsson / cloudSettings
Last active August 13, 2020 21:17
Visual Studio Code Settings Sync Gist
{"lastUpload":"2020-08-13T21:17:43.688Z","extensionVersion":"v3.4.3"}
@hrafnkellpalsson
hrafnkellpalsson / machine.js
Last active January 14, 2020 23:46
Generated by XState Viz: https://xstate.js.org/viz
// * Stubbed out methods so we can copy the machine to the xstate visualizer
const fetchAll = () => {}
const setRemoteData = () => {}
const isDeselectingLastSelectedItem = () => {}
const selectMenuItem = () => {}
const deselectMenuItem = () => {}
const isNotCreated = (ctx, e) => false
const isNotYetActive = (ctx, e) => false
const hasOrderedAndIsActive = (ctx, e) => false
const hasOrderedAndIsExpired = (ctx, e) => false
@hrafnkellpalsson
hrafnkellpalsson / SketchSystems.spec
Created November 25, 2019 19:25
My Awesome Sketch
My Awesome Sketch
First State
some event -> Second State
Second State
const dogFetcherMachine = Machine({
id: "dog fetcher",
initial: "idle",
context: {
dog: null,
error: null
},
states: {
idle: {
on: { FETCH: "loading" }
@hrafnkellpalsson
hrafnkellpalsson / machine.js
Last active November 30, 2019 00:58
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@hrafnkellpalsson
hrafnkellpalsson / machine.js
Last active February 19, 2020 23:38
Generated by XState Viz: https://xstate.js.org/viz
// * Stubbed out methods so we can copy the machine to the xstate visualizer
const fetchAll = () => {}
const setRemoteData = () => {}
const isDeselectingLastSelectedItem = () => {}
const selectMenuItem = () => {}
const deselectMenuItem = () => {}
const isNotCreated = (ctx, e) => false
const isNotYetActive = (ctx, e) => false
const hasOrderedAndIsActive = (ctx, e) => false
const hasOrderedAndIsExpired = (ctx, e) => false
@hrafnkellpalsson
hrafnkellpalsson / machine.js
Last active February 24, 2020 01:35
Generated by XState Viz: https://xstate.js.org/viz
// There must be exactly one initial state, which implies
// there must be at least one finite state.
// const dullHuman = Machine({
// id: 'dullHuman',
// initial: 'idle',
// states: {
// idle: {}
// }
// })
const birthday = Machine({
id: "birthday",
initial: "notStarted",
states: {
started: {
initial: "boring",
entry: (ctx, e) => console.log('Parent entry action executed'),
exit: (ctx, e) => console.log('Parent exit action executed'),
on: {
CAKE_BONANZA: {
const gathering = Machine({
id: "gathering",
initial: "started",
states: {
started: {
entry: (ctx, e) => console.log('"Started" entry action executed'),
exit: (ctx, e) => console.log('"Started" exit action executed'),
on: {
SAME_SAME: {
target: "started",
@hrafnkellpalsson
hrafnkellpalsson / machine.js
Created September 26, 2020 19:44
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions