Skip to content

Instantly share code, notes, and snippets.

View promise_batcher.ts
type PromiseFactory = () => Promise<any>;
function promiseAllBatched(
promiseFactories: PromiseFactory[],
batchSize: number
): Promise<any> {
let completed = 0;
let upNext = 0;
let results: any[] = [];
const initialBatchSize = Math.min(batchSize, promiseFactories.length);
warpling / CAMediaTimingFunction.swift
Last active Apr 13, 2021
Better CAMediaTimingFunctions
View CAMediaTimingFunction.swift
// CAMediaTimingFunction.swift
import UIKit
extension CAMediaTimingFunction {
static let linear = CAMediaTimingFunction(name: .linear)
static let easeOut = CAMediaTimingFunction(name: .easeOut)

‪“‬In what way is JS any more maintainable than CSS? How does writing CSS in JS make it any more maintainable?”

‪Happy to chat about this. There’s an obvious disclaimer that there’s a cost to css-in-js solutions, but that cost is paid specifically for the benefits it brings; as such it’s useful for some usecases, and not meant as a replacement for all workflows. ‬

‪(These conversations always get heated on twitter, so please believe that I’m here to converse, not to convince. In return, I promise to listen to you too and change my opinions; I’ve had mad respect for you for years and would consider your feedback a gift. Also, some of the stuff I’m writing might seem obvious to you; I’m not trying to tell you if all people of some of the details, but it might be useful to someone else who bumps into this who doesn’t have context)‬

So the big deal about css-in-js (cij) is selectors.

ericclemmons /
Last active Apr 13, 2021
HTML5 <details> in GitHub

Using <details> in GitHub

Suppose you're opening an issue and there's a lot noisey logs that may be useful.

Rather than wrecking readability, wrap it in a <details> tag!

 <summary>Summary Goes Here</summary>
tdack /
Created Jun 12, 2016
Custom handlebars helpers for Ghost, as an app
Avaq / combinators.js
Last active Apr 12, 2021
Common combinators in JavaScript
View combinators.js
const I = x => x
const K = x => y => x
const A = f => x => f (x)
const T = x => f => f (x)
const W = f => x => f (x) (x)
const C = f => y => x => f (x) (y)
const B = f => g => x => f (g (x))
const S = f => g => x => f (x) (g (x))
const S_ = f => g => x => f (g (x)) (x)
const S2 = f => g => h => x => f (g (x)) (h (x))
gauntface / toggle-remote-styles.js
Last active Mar 12, 2020
A book marklet to toggle styles.
View toggle-remote-styles.js
javascript:(function(){var styles = document.querySelectorAll('link[rel=\'stylesheet\']'); for (var s = 0; s < styles.length; s++) {styles[s].mediax = styles[s].media;if (styles[s].media === 'only x') { styles[s].media = styles[s].mediax; } else if (styles[s].media !== 'print') {styles[s].media = 'only x';}}})();
mrmrs / github-display-none.css
Last active Nov 2, 2019
Single purpose rulesets to set an element to display none from githubs production css
View github-display-none.css
.table-list-triage {
display: none;
.triage-mode .table-list-non-triage, .triage-mode .table-list-filters {
display: none;
.boxed-group-list>li.approved .btn-sm, .boxed-group-list>li.rejected .btn-sm {
display: none;
.repo-list .participation-graph.disabled {
Vestride /
Last active Apr 14, 2021
Encoding video for the web

Encoding Video


Install FFmpeg with homebrew. You'll need to install it with a couple flags for webm and the AAC audio codec.

brew install ffmpeg --with-libvpx --with-libvorbis --with-fdk-aac --with-opus
bendc / functional-utils.js
Last active Feb 20, 2021
A set of pure ES2015 functions aimed to make functional JavaScript more idiomatic.
View functional-utils.js
// array utils
// =================================================================================================
const combine = (...arrays) => [].concat(...arrays);
const compact = arr => arr.filter(Boolean);
const contains = (() => Array.prototype.includes
? (arr, value) => arr.includes(value)
: (arr, value) => arr.some(el => el === value)