Skip to content

Instantly share code, notes, and snippets.

View ShMcK's full-sized avatar

Shawn McKay ShMcK

View GitHub Profile
@ShMcK
ShMcK / xstateful-react-machine.js
Created September 23, 2018 21:56
xstateful-react machine setup
import { Machine } from 'xstate'
import { createStatefulMachine } from '@avaragado/xstateful'
import { createReactMachine } from '@avaragado/xstateful-react'
import machineState from './state.json'
// a stateless machine
const machine = Machine(machineState)
// a stateful machine
const xsf = createStatefulMachine({ machine })
@ShMcK
ShMcK / xstateful-react-provider.jsx
Last active September 23, 2018 21:58
xstateful-react-provider
import * as React from 'react'
import { Display, Time } from './components'
import ClockMachine from './Machine'
export default class Clock extends React.Component {
render() {
return (
<ClockMachine.Provider>
<ClockMachine.Control onDidMount={this.init}>
@ShMcK
ShMcK / xstateful-react-state-views.jsx
Created September 23, 2018 22:02
Conditionally rendered state components
<Display>
<Time />
<ClockMachine.State
is="AlarmGroup.Ringing"
render={() => <AlarmSetIndicator ringing />}
/>
<ClockMachine.State
is={['AlarmGroup.AlarmSet', 'AlarmGroup.Snoozing']}
render={() => <AlarmSetIndicator />}
/>
@ShMcK
ShMcK / machine.js
Created August 26, 2019 00:00
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@ShMcK
ShMcK / machine.js
Created September 5, 2019 04:08
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@ShMcK
ShMcK / StableDiffusionUI_SageMaker.ipynb
Last active July 12, 2024 14:25
Config for running Automatic1111 Stable Diffusion WebUI on an AWS SageMaker Notebook
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.