Skip to content

Instantly share code, notes, and snippets.

View kbingman's full-sized avatar

Keith Bingman kbingman

  • Vancouver, BC Canada
View GitHub Profile
@kbingman
kbingman / machine.js
Created July 7, 2021 16:15
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@kbingman
kbingman / machine.js
Last active June 23, 2021 16:32
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@kbingman
kbingman / machine.js
Created June 18, 2021 20:27
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@kbingman
kbingman / machine.js
Last active June 16, 2021 06:16
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@kbingman
kbingman / machine.js
Created June 15, 2021 18:39
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
/**
* Fetches a model from the State first, then the API.
* returns a tuple with the data from the API and an updater function that
* updates the server
*/
export const useLens= (
uuid: string
): [Response, SetResponse] => {
// This could be `useSelector` and `useDispatch` if we are using Redux
const [initialData, setData] = useRecoilState(
@kbingman
kbingman / fake-listing.ts
Created October 18, 2019 23:23
Fake Listing
import faker from 'faker';
import { makes } from '../../../../test/makes';
import { Listing } from '../../src/types';
faker.seed(42);
export const createFakeListing = (attr?: any): Listing => {
const [make, model] = makes[faker.random.number(makes.length)];
@kbingman
kbingman / nodes.ts
Last active October 18, 2019 21:58
Demo Node structure
type UUID = string;
interface BaseNode {
uuid: UUID;
path: string; // parent-uuid/uuid
type: "node" | "section" | "group" | "text";
allowedChildren?: ContentNodes; // Optional because the actual instances of Nodes do not need this
children?: UUID[]; // not all Nodes have children
}
@kbingman
kbingman / gist:c9579ed68bb996b24e68
Last active August 29, 2015 14:19
Building Event Driven Applications with Javascript

Overview of Event Driven Patterns (1hr)

  • Large Scale Applications…
  • Event Driven vs. jQuery and Plugins
  • Get NPM and Dev Environment Setup
  • React in a few lines of jQuery
  • jQuery and DOM events
  • Observer Pattern

Exercises

  • Build a simple Instagram API
@kbingman
kbingman / google.feature
Last active August 5, 2019 16:51
A basic test runner to use Yadda with the Nightwatch selenium testing framework.
Feature: Google Demo
Scenario: Google home page
When I open http://google.com
and I should see #viewport