Skip to content

Instantly share code, notes, and snippets.

View jbinto's full-sized avatar

Jesse Buchanan jbinto

View GitHub Profile
# with1p proof of concept, 20251127
with1p() {
# Usage: with1p VAR[=SECRET_NAME] [VAR2[=SECRET_NAME2] ...] -- command [args...]
if [[ $# -lt 2 ]]; then
echo "Usage: with1p VAR[=SECRET_NAME] [VAR2[=SECRET_NAME2] ...] -- command [args...]" >&2
return 1
fi
local specs=()
@jbinto
jbinto / dont_commit_a_file.md
Last active November 27, 2025 18:01
don't commit .vscode/settings.json

scenario: Your team has ~/.vscode/settings.json committed to the repo for reasonable reasons (extensions, etc). You wish to use something like peacock but don't want to force your colors on the whole team.

Fix:

git update-index --skip-worktree .vscode/settings.json

Undo:

@jbinto
jbinto / 01-before_fix_good.md
Last active November 21, 2025 15:58
msw bad socket/EINVAL sequence diagrams

1. Before Fix: The "Happy" Path (Redundant but Safe)

Why it usually works: In a normal request, both the Real Socket and the Mock Socket are alive. The Mock Socket tries to "drive" (call readStart), but the Real Socket is already driving. Libuv handles are generally resilient to being told to "start reading" when they are already reading. It's messy, but not fatal.

sequenceDiagram
    autonumber
    participant Stream as Node Stream Logic
    participant Mock as MockHttpSocket
    participant Real as Real TLSSocket
@jbinto
jbinto / node_debugging_tricks.md
Last active November 8, 2024 18:54
Some dumb node debugging tricks

Some dumb Node.js debugging tricks

On Nov 15 2022 @cszatmary DM'd me about a flaky test he was having trouble with.

I don't want to get too in the weeds here about the specific problem or the challenges of our codebase, but if you would like a tl;dr of the actual issue we encountered, click show gory details below:

Click here to show gory details
  • A brand new Supertest test would sometimes time out after 60 seconds, but only on CircleCI
  • Turning gzip compression off would make the tests pass reliably, this turned out to be a red herring
@jbinto
jbinto / mkjira.md
Last active November 5, 2021 21:17
mkjira (quickly make JIRA tickets from the command line)
@jbinto
jbinto / input.scss
Created November 9, 2020 22:06
Generated by SassMeister.com.
h2 {
:global([data-theme="fancy"]) :global([[data-color="pineapple"]]) & :global(em) {
display: none;
}
}
// option 1 to override fetch, using cypress built-in facilities (e.g. sinon)
cy
// sinon syntax ⬇️
.stub(win, 'fetch')
.withArgs('/graphql')
// The pseudocode-ish that this generates, kinda like this:
const realFetch = window.fetch
window.fetch = (arg1) => {
@jbinto
jbinto / foo.sh
Created February 7, 2017 00:32
Extract info from npm packages
cat /tmp/packages.txt | while read PACKAGE
do
yarn info $PACKAGE --json |
head -n1 |
jq --raw-output '"\"\(.data.name)\", \"\(.data.version)\", \"\(.data.homepage)\", \"\(.data.license)\", \"\(.data.description)\""' |
tee -a /tmp/output3.txt
done
@jbinto
jbinto / Foo.js
Created December 20, 2016 21:19
react-apollo stale variables when mixing pollInterval and skip
import React from 'react';
import gql from 'graphql-tag'
import { graphql } from 'react-apollo'
export const QUERY = gql`
query($fooID: Int!) { foo(id: $fooID) { id } }
`
const withFoo = graphql(QUERY, {
skip: ownProps => ownProps.active !== true,
@jbinto
jbinto / segfault_libgraphqlparser.md
Created July 27, 2016 18:15
segfault libgraphqlparser

https://github.com/Shopify/graphql-parser

Inside visit_variable_definition_name, pry breakpoint, ls node:

GraphQL::Parser::VariableDefinition#methods: default_value  type  variable

node.type or node.default_value will segfault the parser.