Skip to content

Instantly share code, notes, and snippets.

@statonjr
statonjr / machine.js
Created December 4, 2020 14:36
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
Mode
appOffline*
checkingAPI
apiOnline -> online
apiOffline -> checkingInternet
checkingInternet
internetOnline -> online
internetOffline -> offline
online
offline
@statonjr
statonjr / machine.js
Last active September 24, 2020 19:52
Generated by XState Viz: https://xstate.js.org/viz
const checkGlobalAPI = (context, event) => {
return new Promise((resolve, reject) => {
let condition = Math.round(Math.random() * 10) > 8;
console.log(condition);
if (condition) {
resolve(42)
} else {
reject('foo')
}
});
@statonjr
statonjr / SketchSystems.spec
Created November 20, 2019 20:44 — forked from lynaghk/SketchSystems.spec
Search Bar*
Search Bar*
Idle*
focused -> Active
Active
canceled -> Idle
typed -> Text Entry
Empty*
@statonjr
statonjr / 1_initial_migration.rb
Created September 8, 2019 20:29 — forked from wrburgess/1_initial_migration.rb
Setting up UUID columns for Rails 5+ models utilizing Postgres 9.4+
class InitialMigration < ActiveRecord::Migration[5.0]
def change
enable_extension "pgcrypto" unless extension_enabled?("pgcrypto")
end
end
@statonjr
statonjr / SketchSystems.spec
Last active November 20, 2019 20:39
Onboarding*
Onboarding*
Idle*
signup -> Signup
Customer
Validate Email
click? -> Change Password
no click? -> NotVerified
Auth Service
@statonjr
statonjr / SketchSystems.spec
Last active December 23, 2018 13:51
Login Flow
Login Flow
Unauthenticated*
login -> Error?
Authenticated
verified? -> Verified
not verified? -> Unverified
Verified
projects? -> Ready
no projects? Setup
Unverified
@statonjr
statonjr / SketchSystems.spec
Last active September 19, 2018 12:31
Darcie*
Darcie*
Question*
try submitting -> Validate
No Errors*
Bad Input Error
Validate
valid? -> History
invalid? -> Bad Input Error
@statonjr
statonjr / SketchSystems.spec
Created July 18, 2018 20:58
Client Registration
Client Registration
Unauthenticated
ready -> Unauthenticated
submit -> Authenticated
Authenticated
Nag*
Main Screen
Default*
task label pressed -> Text Entry
add 1 h button pressed -> Ticking
add 1 m button pressed -> Ticking
subtract 1 h button pressed -> Ticking
subtract 1 m button pressed -> Ticking
info button pressed -> Display
add task button pressed -> New Main Screen