Skip to content

Instantly share code, notes, and snippets.

Avatar
Building new teams at @Shopify

Francis Gulotta reconbot

Building new teams at @Shopify
View GitHub Profile
@reconbot
reconbot / graphql-playground.tsx
Created Jul 1, 2021
How to get graphql playground to work on nextjs
View graphql-playground.tsx
import dynamic from 'next/dynamic'
import Head from 'next/head'
const WS_URL = process.env.NEXT_PUBLIC_WS_API_ENDPOINT
const API_URL = process.env.NEXT_PUBLIC_API_ENDPOINT
// You might ask yourself, what is this business?
// And I might ask why on earth does Playground require window on module load breaking any hope
// of ssr even if we don't render it but only import it
const Playground = dynamic<any>(
@reconbot
reconbot / test.js
Created Jun 21, 2021
How to use import to import an ems module form a cjs file
View test.js
const slugifyP = import('@sindresorhus/slugify')
slugifyP.then(slugify => console.log(slugify.default('I ♥ Dogs')))
@reconbot
reconbot / build.ts
Created Jun 14, 2021
Build and watch commands for esbuild and architect https://arc.codes
View build.ts
import { buildFunctions, findFunctions } from './lib-build'
async function run() {
const funcs = await findFunctions()
await buildFunctions(funcs)
}
run()
@reconbot
reconbot / batchFetchExchange.ts
Last active Jun 8, 2021
A batching exchange for URQL that lets you opt out of batch queries adapted form @jakubriedl's POC This version works on non persisted queries.
View batchFetchExchange.ts
// Adapted from https://gist.github.com/jakubriedl/812c2a7b26927a2249a4719555d9a0ca
import DataLoader from 'dataloader'
import { Exchange, Operation } from 'urql'
import { pipe, map } from 'wonka'
interface BatchRequest {
url: RequestInfo | string
options?: RequestInit
}
@reconbot
reconbot / AsyncFunctionReturn.ts
Last active Apr 4, 2021
This type will unwrap an async function and give you the type of the returned promise
View AsyncFunctionReturn.ts
type AsyncFuncReturn<T> = T extends (...args: any[]) => Promise<infer U> ? U : never
// eg
const randomFunction = async () => ({ a: 4, b: "string" })
type RandomReturn = AsyncFuncReturn<typeof randomFunction>
const foo: RandomReturn = await randomFunction()
View 20111011_SteveYeggeGooglePlatformRant.md

Stevey's Google Platforms Rant

I was at Amazon for about six and a half years, and now I've been at Google for that long. One thing that struck me immediately about the two companies -- an impression that has been reinforced almost daily -- is that Amazon does everything wrong, and Google does everything right. Sure, it's a sweeping generalization, but a surprisingly accurate one. It's pretty crazy. There are probably a hundred or even two hundred different ways you can compare the two companies, and Google is superior in all but three of them, if I recall correctly. I actually did a spreadsheet at one point but Legal wouldn't let me show it to anyone, even though recruiting loved it.

I mean, just to give you a very brief taste: Amazon's recruiting process is fundamentally flawed by having teams hire for themselves, so their hiring bar is incredibly inconsistent across teams, despite various efforts they've made to level it out. And their operations are a mess; they don't real

View README.md

Hi

digraph finite_state_machine {
	rankdir=LR;
	size="8,5"
	node [shape = doublecircle]; LR_0 LR_3 LR_4 LR_8;
	node [shape = circle];
      
	LR_0 -> LR_2 [ label = "SS(B)" ];
@reconbot
reconbot / mouse-parser.js
Last active Aug 24, 2019
This parses the ms serial mouse wire protol into randomly named events.
View mouse-parser.js
const { Transform } = require('stream')
const debug = require('debug')('serialport/mouse-parser')
const StartByteMarkerByte = 0b01000000
const LeftMouseButtonByte = 0b00100000
const RightMouseButtonByte = 0b00010000
const isStart = byte => byte & StartByteMarkerByte
const DEFAULT_STATE = Object.freeze({
View log.log
### STARTED Filters for GitHub Actions 03:52:54Z
Pulling image: gcr.io/github-actions-images/action-runner:latest
latest: Pulling from github-actions-images/action-runner
cd784148e348: Already exists
23e2dcc28013: Pulling fs layer
1b231fbdf683: Pulling fs layer
bd89504cdd3c: Pulling fs layer
ad8707eb42ef: Pulling fs layer
ad8707eb42ef: Waiting
@reconbot
reconbot / .tesselinclude
Created Nov 26, 2018
My hanging js codee
View .tesselinclude
node_modules/blynk-library/certs/server.crt