Skip to content

Instantly share code, notes, and snippets.

View chrisjbrown's full-sized avatar

Christopher Brown chrisjbrown

  • Amsterdam, Netherlands
View GitHub Profile
@chrisjbrown
chrisjbrown / machine.js
Created January 17, 2023 17:36
Generated by XState Viz: https://xstate.js.org/viz
View machine.js
const searchMachine = Machine({
id: 'search',
initial: 'idle',
context: {
results: [],
errorMessage: null,
},
states: {
idle: {
on: { FETCH: 'loading' },
View gitconfig
[alias]
##
# One letter alias for our most frequent commands.
#
# Guidelines: these aliases do not use options, because we want
# these aliases to be easy to compose and use in many ways.
##
a = add
View timeit
const tsA = [[1, 'a'], [3, 'c'], [4, 'c'], [8, 'b'], [9, 'a']]
const tsB = [[1, 'c'], [2, 'b'], [3, 'c'], [4, 'a'], [5, 'b'], [7, 'a'], [9, 'a']]
function getNext(A, B) {
let smallestA = A[0];
let smallestB = B[0];
if (!smallestB && smallestA) {
return A.shift()
}