Skip to content

Instantly share code, notes, and snippets.

View wmcbain's full-sized avatar

Wyatt McBain wmcbain

View GitHub Profile
@wmcbain
wmcbain / machine.js
Created June 2, 2020 17:09
Generated by XState Viz: https://xstate.js.org/viz
const authMachine = Machine({
id: 'auth_machine',
initial: 'authIsLoading',
context: {
sessionToken: null,
},
states: {
authIsLoading: {
on: {
LOGGED_IN: 'isLoggedIn',
@wmcbain
wmcbain / machine.js
Created April 6, 2020 16:34
Generated by XState Viz: https://xstate.js.org/viz
const fileMachine = Machine({
id: 'fileMachine',
initial: 'checkPackageJsonChanged',
states: {
checkPackageJsonChanged: {
entry: 'checkPackageJsonChanged',
on: {
PACKAGE_JSON_CHANGED: 'checkUniversalPackagesChanged',
PACKAGE_JSON_NOT_CHANGED: 'exit'
@wmcbain
wmcbain / machine.js
Last active March 18, 2020 20:48
Generated by XState Viz: https://xstate.js.org/viz
const authMachine = Machine({
id: 'auth_machine',
initial: 'authIsLoading',
context: {
sessionToken: null,
},
states: {
authIsLoading: {
on: {
LOGGED_IN: 'isLoggedIn',
@wmcbain
wmcbain / machine.js
Last active March 14, 2020 17:45
Generated by XState Viz: https://xstate.js.org/viz
const authMachine = Machine({
id: 'auth_machine',
initial: 'authIsLoading',
context: {
sessionToken: null,
},
states: {
authIsLoading: {
on: {
LOGGED_IN: 'isLoggedIn',
@wmcbain
wmcbain / machine.js
Last active March 12, 2020 00:05
Generated by XState Viz: https://xstate.js.org/viz
const authMachine = Machine({
id: 'auth_machine',
initial: 'authIsLoading',
context: {
sessionToken: null,
},
states: {
// HomeScreen.tsx
authIsLoading: {
on: {
@wmcbain
wmcbain / machine.js
Last active March 5, 2020 19:43
Generated by XState Viz: https://xstate.js.org/viz
const authMachine = Machine({
id: 'auth_machine',
initial: 'authIsLoading',
context: {
sessionToken: null,
},
states: {
// HomeScreen.tsx
authIsLoading: {
on: {
@wmcbain
wmcbain / machine.js
Last active March 5, 2020 17:02
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@wmcbain
wmcbain / machine.js
Created March 5, 2020 00:59
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@wmcbain
wmcbain / useSize.tsx
Last active November 17, 2021 21:43
Small little hook to use in TypeScript React Native apps to get the size of a component onLayout
import { useCallback, useState } from 'react';
import { LayoutChangeEvent } from 'react-native';
export const useSize = (): [
{
height: number;
width: number;
},
(event: LayoutChangeEvent) => void
] => {

Keybase proof

I hereby claim:

  * I am wmcbain on github.   * I am wmcbain (https://keybase.io/wmcbain) on keybase.   * I have a public key ASBFVUH8JRFBfk8vc0h1TJgmBvyxqOE7M9tddtysFeNeQwo

To claim this, I am signing this object: