Skip to content

Instantly share code, notes, and snippets.

@dtmrc
dtmrc / .gitconfig
Created August 7, 2021 03:41 — forked from pyrtsa/.gitconfig
A few `git log` commands where things are nicely aligned
[alias]
l50 = "!f () { git log --abbrev-commit --date=short --pretty=format:'%h%x00%cd%x00%s%x00%an%x00%d' $@ | gawk -F '\\0' '{ printf \"\\033[31m%s\\033[0m \\033[32m%s\\033[0m %-50s \\033[30;1m%s\\033[0m\\033[33m%s\\n\", $1, $2, gensub(/(.{49}).{2,}/, \"\\\\1…\",\"g\",$3), $4, $5 }' | less -R; }; f"
l80 = "!f () { git log --abbrev-commit --date=short --pretty=format:'%h%x00%cd%x00%s%x00%an%x00%d' $@ | gawk -F '\\0' '{ printf \"\\033[31m%s\\033[0m \\033[32m%s\\033[0m %-80s \\033[30;1m%s\\033[0m\\033[33m%s\\n\", $1, $2, gensub(/(.{79}).{2,}/, \"\\\\1…\",\"g\",$3), $4, $5 }' | less -R; }; f"
lg50 = "!f () { git log --graph --color=always --abbrev-commit --date=relative --pretty=format:'%x00%h%x00%s%x00%cd%x00%an%x00%d' $@ | gawk -F '\\0' '{ printf \"%s\\033[31m%s\\033[0m %-50s \\033[32m%14s\\033[0m \\033[30;1m%s\\033[0m\\033[33m%s\\n\", $1, $2, gensub(/(.{49}).{2,}/, \"\\\\1…\",\"g\",$3), $4, $5, $6 }' | less -R; }; f"
lg80 = "!f () { git log --graph --color=always --abbrev-commit --date=re
@dtmrc
dtmrc / .prompt-time
Created August 7, 2021 03:44 — forked from pyrtsa/.prompt-time
Make Bash report the start times all commands, and total durations of long-running ones.
export _ps1_timer
function _ps1_timer_start {
# echo START
_ps1_timer=${_ps1_timer:-`gdate +%s%N 2> /dev/null || date +%s%N`};
}
function _ps1_timer_stop {
# echo STOP
if [ -z "$_ps1_timer" ]; then
@dtmrc
dtmrc / version.bash
Created August 7, 2021 03:53 — forked from pyrtsa/version.bash
Xcode: Set version and build number from Git
#!/bin/bash
# Xcode: Set version and build number from Git
# --------------------------------------------
#
# This script sets the version number `CFBundleShortVersionString` to one of
#
# - `1.2.3` -- for the tagged commit `v1.2.3` or a hyphen-separated prerelease,
# e.g. `v1.2.3-alpha`, `v1.2.3-alpha.2`, `v1.2.3-beta`, `v1.2.3-rc`.
# - `1.2.3-7-gabc1234` -- at commit `abc1234`, 7 commits after `v1.2.3`,
# - `1.2.3-7-gabc1234-dirty` -- when there are uncommitted changes, or
@dtmrc
dtmrc / example.md
Created September 8, 2021 05:50 — forked from ericclemmons/example.md
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
'use strict';
const download = require('download');
/**
* Download all ballots
*/
const dl = async (baseurl, dest) => {
const pending = [];
@dtmrc
dtmrc / first-amendment.md
Created September 12, 2021 01:52 — forked from jonschlinkert/first-amendment.md
Free speech is not without exceptions.

What Does Free Speech Mean?

Among other cherished values, the First Amendment protects freedom of speech. The U.S. Supreme Court often has struggled to determine what exactly constitutes protected speech. The following are examples of speech, both direct (words) and symbolic (actions), that the Court has decided are either entitled to First Amendment protections, or not.

Freedom of speech includes the right:

  • Not to speak (specifically, the right not to salute the flag). West Virginia Board of Education v. Barnette, 319 U.S. 624 (1943).
  • Of students to wear black armbands to school to protest a war (“Students do not shed their constitutional rights at the schoolhouse gate.”). Tinker v. Des Moines, 393 U.S. 503 (1969).
  • To use certain offensive words and phrases to convey political messages. Cohen v. California, 403 U.S. 15 (1971).
  • To contribute money (under certain circumstances) to political campaigns. Buckley v. Valeo, 424 U.S. 1 (1976).
diff --git a/node_modules/react-update-url-on-scroll/lib/Manager.js b/node_modules/react-update-url-on-scroll/lib/Manager.js
index 6e8de9f..7cb49c4 100644
--- a/node_modules/react-update-url-on-scroll/lib/Manager.js
+++ b/node_modules/react-update-url-on-scroll/lib/Manager.js
@@ -18,11 +18,11 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
var defaultConfig = {
affectHistory: false,
- debounce: 100,
keepLastAnchorHash: false,
// Adapted from: https://digitalbunker.dev/2020/09/13/understanding-gaussian-blurs/
function gaussianBlurMatrix(blurRadius: number) {
if (blurRadius !== Math.round(blurRadius) || blurRadius <= 0) {
throw Error('Blur radius must be a positive integer')
}
const kernel: number[] = []
const kernelWidth = 1 + 2 * blurRadius
const kernelSize = kernelWidth * kernelWidth
@dtmrc
dtmrc / runTopological.ts
Created September 12, 2021 01:55 — forked from aleclarson/runTopological.ts
Run an async action in topological order (dependencies run first)
export const runTopological = <T>(
packages: PackageJson[],
action: (pkg: PackageJson) => Promise<T>
): Promise<T[]> => {
const promises: Promise<T>[] = []
const run = (pkg: PackageJson, i: number) =>
promises[i] ||
(promises[i] = Promise.all(
Object.keys(pkg.dependencies || {}).map(name => {
const i = packages.findIndex(pkg => pkg.name === name)