Skip to content

Instantly share code, notes, and snippets.

View flybayer's full-sized avatar
🤓
CEO Flightcontrol + Pilot

Brandon Bayer flybayer

🤓
CEO Flightcontrol + Pilot
View GitHub Profile
@flybayer
flybayer / Link.tsx
Last active July 1, 2021 07:40
Much nicer and more intuitive Next.js Link abstraction
const res = await fetch(action, {
method,
body: data,
headers: {
Accept: 'application/json',
},
})
@flybayer
flybayer / machine.js
Created February 6, 2020 04:49
Generated by XState Viz: https://xstate.js.org/viz
const checkoutAppMachine = Machine(
{
id: "checkoutApp",
initial: "studentEntry",
strict: true,
context: {
currentStepNumber: 0,
account: {
authenticated: false,
},
@flybayer
flybayer / machine.js
Created November 27, 2019 04:56
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@flybayer
flybayer / machine.js
Created August 8, 2019 15:49
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
module.exports = {
config: {
// default font size in pixels for all tabs
fontSize: 14,
// font family with optional fallbacks
fontFamily: '"Source Code Pro for Powerline", Menlo, "DejaVu Sans Mono", "Lucida Console", monospace',
// terminal cursor background color and opacity (hex, rgb, hsl, hsv, hwb or cmyk)
cursorColor: 'rgba(248,28,229,0.8)',
@flybayer
flybayer / convertStringToFile.jsx
Created September 4, 2016 20:12
Create downloadable text file from JavaScript
const convertStringToFile = (aString) => {
const data = new Blob([aString], {type: 'text/plain'})
return window.URL.createObjectURL(data)
}
<a
download="filename.txt"
href={convertStringToFile}
>
Download
@flybayer
flybayer / start.js
Created August 30, 2016 15:58 — forked from toddgeist/start.js
Using dotenv to load vars when dploying to now. But still keep it out of your repo.
// load as early as possible
if(process.env.NOW){
require('dotenv').config({path:'./.envnow', silent:true});
}else{
require('dotenv').config({silent:true});
}
// now you can deploy with:
//$cp .env .envnow && now && rm -r .envnow
@flybayer
flybayer / challenge.adoc
Last active January 12, 2016 19:46 — forked from cheerfulstoic/graph_gist_template.adoc
My Submission

TODO

  1. Create many more nodes

  2. Create queries for the questions

  3. Review questions & maybe add more or more complexity

  4. Create domain model image

What can I eat for the holidays??

@flybayer
flybayer / _.md
Last active October 7, 2015 01:13
Role Hive