Skip to content

Instantly share code, notes, and snippets.

View reconbot's full-sized avatar
🏴‍☠️
Building at @github

Francis Gulotta reconbot

🏴‍☠️
Building at @github
View GitHub Profile
export interface SpacePacketHeader {
versionNumber: string | number
identification: {
apid: number
secondaryHeader: number
type: number
}
sequenceControl: {
packetName: number
sequenceFlags: number
@reconbot
reconbot / my-git.zsh
Created November 4, 2021 04:06
My git shortcuts
alias gb='gh pr view -w'
alias gp='git push origin HEAD'
alias gpf='git push --force-with-lease origin HEAD'
alias gpfo='git push --force-with-lease origin HEAD && gb'
alias gpo='git push origin HEAD && gb'
alias gcm='git checkout $(git_detect_main_branch)'
alias gcmp='git checkout $(git_detect_main_branch) && git pull origin $(git_detect_main_branch) --ff-only'
alias grom='git fetch && git rebase --autostash origin/$(git_detect_main_branch)'
function git_detect_main_branch() {
@reconbot
reconbot / createComplexityPlugin.ts
Last active June 20, 2023 14:43
An Apollo Plugin for graphql-query-complexity
import { ComplexityEstimator, getComplexity } from 'graphql-query-complexity'
import { GraphQLError, GraphQLSchema, separateOperations } from 'graphql'
import { PluginDefinition } from 'apollo-server-core'
export const createComplexityPlugin = ({
schema,
maximumComplexity,
estimators,
onComplete,
createError = (max, actual) => { throw new GraphQLError(`Query too complex. Value of ${actual} is over the maximum ${max}.`) },
@reconbot
reconbot / graphql-playground.tsx
Created July 1, 2021 15:22
How to get graphql playground to work on nextjs
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 June 21, 2021 03:25
How to use import to import an ems module form a cjs file
const slugifyP = import('@sindresorhus/slugify')
slugifyP.then(slugify => console.log(slugify.default('I ♥ Dogs')))
@reconbot
reconbot / build.ts
Created June 14, 2021 01:39
Build and watch commands for esbuild and architect https://arc.codes
import { buildFunctions, findFunctions } from './lib-build'
async function run() {
const funcs = await findFunctions()
await buildFunctions(funcs)
}
run()
@reconbot
reconbot / batchFetchExchange.ts
Last active February 13, 2024 11:19
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.
// 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 April 4, 2021 01:05
This type will unwrap an async function and give you the type of the returned promise
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()

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

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 -&gt; LR_2 [ label = "SS(B)" ];