Skip to content

Instantly share code, notes, and snippets.

function useCachedAbortiveQuery<T>(
query: DocumentNode,
variables: Record<string, unknown>,
deps: Array<any>
) {
const apolloClient = useApolloClient();
const [data, setData] = useState<T>();
const [error, setError] = useState<Error | null>(null);
const [loading, setLoading] = useState<boolean>(true);
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
warpling / CAMediaTimingFunction.swift
Last active June 14, 2022 11:15
Better CAMediaTimingFunctions
//
// CAMediaTimingFunction.swift
import UIKit
extension CAMediaTimingFunction {
static let linear = CAMediaTimingFunction(name: .linear)
static let easeOut = CAMediaTimingFunction(name: .easeOut)
@threepointone
threepointone / for-snook.md
Last active August 26, 2023 15:43
For Snook

https://twitter.com/snookca/status/1073299331262889984?s=21

‪“‬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
ericclemmons / example.md
Last active February 22, 2024 16:18
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!

<details>
 Summary Goes Here
@tdack
tdack / README.md
Created June 12, 2016 10:24
Custom handlebars helpers for Ghost, as an app
@Avaq
Avaq / combinators.js
Last active March 18, 2024 20:49
Common combinators in JavaScript
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
gauntface / toggle-remote-styles.js
Last active March 12, 2020 12:56
A book marklet to toggle styles.
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
mrmrs / github-display-none.css
Last active November 2, 2019 03:09
Single purpose rulesets to set an element to display none from githubs production 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
Vestride / encoding-video.md
Last active March 12, 2024 16:41
Encoding video for the web

Encoding Video

Installing

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