Skip to content

Instantly share code, notes, and snippets.

View andrewiggins's full-sized avatar

Andre Wiggins andrewiggins

View GitHub Profile
@andrewiggins
andrewiggins / .gitignore
Last active January 28, 2022 19:10
Webpack example
node_modules
package-lock.json
@andrewiggins
andrewiggins / notreact.tsx
Created October 7, 2021 03:26
Trying to get JSX children type verification
declare namespace NotReact {
type JSXElementConstructor<P> = (props: P) => Element | null;
type JSXType<P> = "div" | JSXElementConstructor<P>;
interface Element<P = any, T extends JSXType<any> = JSXType<P>> {
type: T;
props: P;
}
}
@andrewiggins
andrewiggins / .gitignore
Last active April 30, 2021 13:08
Preact + React types
node_modules
lib
@andrewiggins
andrewiggins / machine.js
Last active July 29, 2020 21:32
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
// - XState (all XState exports)
@andrewiggins
andrewiggins / machine.js
Last active July 27, 2020 19:12
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@andrewiggins
andrewiggins / preact-checker.js
Created July 16, 2020 17:04
Find any preact roots on a webpage
// Run `"javascript:$(terser .\preact-checker.js)" > .\preact-checker.min.js` to make it a bookmarklet
(function () {
var expando =
typeof Symbol != "undefined" && Symbol.for && Symbol.for("preactattr");
function isMatch(node) {
if ("__k" in node && "props" in node.__k && "type" in node.__k) {
return true;
}
return (
@andrewiggins
andrewiggins / machine.js
Last active July 12, 2020 22:00
Generated by XState Viz: https://xstate.js.org/viz
var minHoldTime = 2500; // milliseconds
var checkDelay = 500 // milliseconds, defaults to 500ms or minHoldTime/2 if minHoldTime < 500
var minWaitTime = 1; // seconds
var maxWaitTime = 3; // seconds
var waitTimeout = 10; // seconds
// FYI, if using full XState, could use the 'invoke' property to call functions
// that return Promises that resolve or fail, and change state based on that.
// Since this machine generally has two transitions out of the interesting
// states, we could model the lock checking as success/failure to signal which
@andrewiggins
andrewiggins / machine.js
Last active July 12, 2020 18:53
Generated by XState Viz: https://xstate.js.org/viz
Machine({
id: 'Lock',
initial: 'acquiring',
context: {
held_time: 0 // Cumulative time the lock has been held
},
states: {
// Read lock and either keep waiting or write & hold
acquiring: {
entry() {
@andrewiggins
andrewiggins / v8-flags.txt
Created July 7, 2020 02:50
List of V8 flags
#########################################
#
# List of Native functions https://github.com/v8/v8/blob/2685658cc0cce01c47a43049bd5394594ccb7400/src/runtime/runtime.h#L1
#
#########################################
SSE3=1 SSSE3=1 SSE4_1=1 SSE4_2=1 SAHF=1 AVX=1 FMA3=1 BMI1=1 BMI2=1 LZCNT=1 POPCNT=1 ATOM=0
Synopsis:
shell [options] [--shell] [<file>...]
@andrewiggins
andrewiggins / Readme.md
Last active March 27, 2018 13:21
Preact componentDidCatch performance

Preact componentDidCatch performance

Environment

  • The benchmark was run on a HP Z440 (3.5 GHz Intel Xeon E5-1650 v3, 32 GB RAM, Windows 10 1709, Chrome 64.0.3282.186 (64-bit))
  • Ran npm run selenium -- --count 10 --framework preact in the webdriver-ts of this js-framework-benchmarks fork

Duration in milliseconds ± standard deviation (Slowdown = Duration / Fastest)