Skip to content

Instantly share code, notes, and snippets.

View chaance's full-sized avatar
🏄‍♂️
Out there

Chance Strickland chaance

🏄‍♂️
Out there
View GitHub Profile
@chaance
chaance / node-workshop-notes.md
Created April 7, 2021 20:43
Node Workshop Notes

Browser JavaScript and Node overlap:

  • Browser JavaScript
    • window
    • document
    • localStorage
  • Node
    • fs
    • path
    • http
  • Both
const PLAID_KEYS = ["CLIENT_ID", "PUBLIC_KEY", "SECRET_KEY"] as const;
const PREFIX = 'PLAID_'
const POST_FIX =
process.env.NODE_ENV === "development"
? "_DEV"
: process.env.NODE_ENV === "production"
? ""
: "_TEST";

Prerequisites

For taking our Core Workshop, attendees should:

  • Carefully review the README in our workshop repository, particularly the section "What do I need to do before attending React Training" Checklist
    • Install and Setup outlines the software requirements for running the workshop lessons and exercises
    • We highly recommend enabling attendees to run software locally for the best experience
    • We highly recommend having attendees clone our repository, run all scripts outlined in the README, and working through potential issues before the workshop starts to reduce time spent on troubleshooting and eating into instruction time
  • We will be running the core-v2 course, so run scripts relevant to that when prompted (See [*Running the Course and Lesson Mat
@chaance
chaance / constructor-type-question.ts
Created March 3, 2021 16:03
constructor-type-question.ts
class Base {
static booted() {
console.log(false);
}
constructor() {
// This is a valid way to call a static method
// from a non-static method AFAICT.
// Anyone know why TS can't infer more from
// from the type of this.constructor?
@chaance
chaance / nobr.js
Created February 8, 2021 18:23
React <nobr> replacement
const Nobr = React.forwardRef((props, ref) => (
<span ref={ref} {...props} style={{ whiteSpace: 'nowrap', ...props.style }} />
));
@chaance
chaance / machine.js
Created January 12, 2021 22:24
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
const { state, send } = useStateMachine({
id: 'presence',
initial: present ? 'mounted' : 'unmounted',
states: {
mounted: {
on: {
UNMOUNT: 'unmounted',
ANIMATION_OUT: 'unmountSuspended',
TRANSITION_OUT: 'unmountSuspended',
},
@chaance
chaance / machine.js
Created October 14, 2020 22:54
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@chaance
chaance / machine.js
Created October 9, 2020 21:16
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
/**
* @typedef {Object} ClassifyProps
* @property {React.ElementType} [as] - Element to render
* @property {import('clsx').ClassValue} [className] - Composable classnames passed to clsx
*/
/**
* @param {ClassifyProps} props
*/
function Classify({ as: El = "div", ...props }) {