Skip to content

Instantly share code, notes, and snippets.

View barryam3's full-sized avatar

Barry A. McNamara III barryam3

View GitHub Profile
@barryam3
barryam3 / gist:82007cf5ef6b1c27621e0395ba9a1e71
Created July 23, 2025 19:09
yarn test --prod failures for PR
$ yarn test --prod
yarn run v1.22.22
$ node ./scripts/jest/jest-cli.js --prod
$ NODE_ENV=production RELEASE_CHANNEL=experimental compactConsole=false node ./scripts/jest/jest.js --config ./scripts/jest/config.source.js
Running tests for default (experimental)...
FAIL packages/react-reconciler/src/__tests__/ReactHooksWithNoopRenderer-test.js
● ReactHooksWithNoopRenderer › useEffect › errors thrown in passive destroy function within unmounted trees › should use the nearest still-mounted boundary if there are no unmounted boundaries
@barryam3
barryam3 / arduino-readall.ino
Created June 21, 2025 21:30
Arduino Read All GPIO Pins
// Pins 0 and 1 are reserved for USB serial communication.
static const int MIN_PIN = 2;
static int prevStates[NUM_DIGITAL_PINS];
void setup() {
for (int i = MIN_PIN; i < NUM_DIGITAL_PINS; i++) {
pinMode(i, INPUT_PULLUP);
// Pin states are 0 or 1. We print pin states as they change. Initializing
// them all to -1 means we print them all on the first loop.
prevStates[i] = -1;
@barryam3
barryam3 / webpack.config.js
Last active May 13, 2025 22:10
React Compiler Webpack Decorators
// How to use react-compiler-webpack with experimental decorators
// With @babel/plugin-syntax-decorators installed:
defineReactCompilerLoaderOption({
babelTransFormOpt: {
parserOpts: {
plugins: ['decorators']
}
}
})
@barryam3
barryam3 / TriStateCheckbox.jsx
Last active April 15, 2019 04:32
Tri-State Checkbox -- React Material UI
import React, { Component } from 'react';
import Checkbox from '@material-ui/core/Checkbox';
/**
* Tri-state wrapper for material-ui checkbox
* @prop {boolean | null} checked - the state of the checkbox
* true means checked
* false means unchecked
* null (or undefined) means indeterminate
* @prop {(event, checked: boolean | null) => void} onChange
@barryam3
barryam3 / range.js
Last active April 15, 2019 04:38
JavaScript implementation of Python 2 range function.
/**
* A JavaScript implementation of the Python range function.
* @param {number} a - start, or stop if b is not given
* @param {number} [b] - stop
* @param {number} [step=1]
* @throws {TypeError} if a non-integer argument is given
* @return {number[]}
* range(a) => [0, 1, ..., a-1] ([] if a <= 0)
* range(a, b) => [a, a+1, ..., b-1] ([] if a >= b)
* range(a, b, s) => [a, a+s, a+2*s, ..., a+n*s] for max int n s.t. a+n*s < b ([] if a >= b)