Skip to content

Instantly share code, notes, and snippets.

View deathbearbrown's full-sized avatar

Sue Lockwood deathbearbrown

  • Seattle, WA
View GitHub Profile
@briancavalier
briancavalier / typescript-strongly-typed-variadic-1.md
Last active October 12, 2023 18:34
A technique for strongly-typed, heterogeneous variadic function types in Typescript

Simpler Variadic Function Types in TypeScript (part 1)

Variadic functions, such as the common zip function on arrays, are convenient and remove the need for lots of specific arity-function variants, e.g., zip2, zip3, zip4, etc. However, they can be difficult and tedious to type correctly in TypeScript when the return type depends on the parameter types, and the parameter types are heterogeneous.

Zip Example

Given a typical zip on arrays:

const a: number[] = [1, 2, 3]

gif-from-tweet

There are so many great GIFs out there and I want to have copies of them. Twitter makes that harder than it should be by converting them to MP4 and not providing access to the source material. To make it easier, I made a bash pipeline that takes a tweet URL and a filename, extracts the MP4 from that tweet and uses ffmpeg to convert back to GIF.

Dependencies

  • ffmpeg
    • macOS: brew install ffmpeg
    • Ubuntu/Debian: apt install ffmpeg
@rwaldron
rwaldron / index.js
Last active June 20, 2016 17:19
Gistorial: Grove RGB LCD with Tessel 2
var Tessel = require("tessel-io");
var five = require("johnny-five");
var board = new five.Board({
io: new Tessel()
});
board.on("ready", function() {
var lcd = new five.LCD({
controller: "JHD1313M1"
});
@rwaldron
rwaldron / controller.js
Last active August 29, 2015 14:13
OWI Wired Controller
var five = require("../lib/johnny-five");
var Lever = require("./lever")(five);
var board = new five.Board();
board.on("ready", function() {
var pins = [1, 2, 3, 4, 5];
var levers = pins.map(function(pin) {
return new Lever(pin);
});
@webmeadow
webmeadow / Bún chả (Grilled Pork)
Last active December 18, 2015 10:10
Vietnamese food is delicious.
1/2 onion
2 t sugar
3/4 t black pepper
1 T maple syrup or honey
2.5 T fish sauce (our fave is Golden Boy with the laughing baby on the bottle)
3 T oil (grapeseed, canola, whatev)
Smush all that stuff together. I like to puree it in a mini-processor, but hand-mixed (w/ minced onion) works too.
2 lbs pork shoulder, cut into strips (~ 3 x 1 x 1/4" if you're feeling precise)
@chetan
chetan / yardoc_cheatsheet.md
Last active May 10, 2024 02:53
YARD cheatsheet