Skip to content

Instantly share code, notes, and snippets.

Avatar

Jason Lengstorf jlengstorf

View GitHub Profile
View machine.js
const formatCommand = msg => {
const { name, duration, message, audio, image } = msg.handler;
return {
command: name,
message,
audio,
image,
duration: duration * 1000, // convert seconds to milliseconds
View machine.js
const effectsMachine = Machine({
id: 'effects',
initial: 'idle',
context: {
transitionSpeed: 600,
duration: 4000,
},
states: {
idle: {
on: {
View machine.js
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
View machine.js
const checkAuth = () => false;
const getTwitchAuth = async () => ({id: 123, displayName: 'jlengstorf'});
const getNetlifyAuth = async () => 'auth';
const getCurrentConfig = () => 'config';
const getNetlifySites = () => ['site'];
const machine = Machine({
id: 'dashboard',
initial: 'checkingAuth',
context: {
View machine.js
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
View bit.js
schema.buildInterfaceType({
name: "MyInterface",
fields: {
name: {
type: "String!",
resolve: () => 'data'
}
},
}),
@jlengstorf
jlengstorf / airtable-accessibility.diff
Created Jul 9, 2019
Markup changes to make Airtable form fields more accessible.
View airtable-accessibility.diff
<div class="sharedFormField required">
- <div class="title">Organizer's First Name</div>
+ <label for="input1" class="title">Organizer's First Name</div>
<div class="cellContainer">
<div class="cell formCell" data-columntype="text">
<div class="flex-auto flex baymax">
<input
+ id="input1"
type="text"
value=""
View quick-slugify.js
// Quick-and-dirty helper to convert strings into URL-friendly slugs.
const slugify = str =>
str
.toLowerCase()
.replace(/[^a-z0-9]+/g, '-')
.replace(/(^-|-$)+/g, '');
View gatsby-node.js
const createNodeHelpers = require('gatsby-node-helpers').default;
const people = require('./data/people.json');
const cocktails = require('./data/cocktails.json');
const { createNodeFactory } = createNodeHelpers({
typePrefix: 'Relationships'
});
const PersonNode = createNodeFactory('Person');
const CocktailNode = createNodeFactory('Cocktail');
@jlengstorf
jlengstorf / gatsby-node.js
Created Oct 9, 2018
Creating node relationships in Gatsby.
View gatsby-node.js
const createNodeHelpers = require('gatsby-node-helpers').default;
const { createNodeFactory } = createNodeHelpers({
typePrefix: 'MyData'
});
const FooNode = createNodeFactory('Foo');
const BarNode = createNodeFactory('Bar');
const foo = { id: 'foo', value: 'foo' };
You can’t perform that action at this time.