Skip to content

Instantly share code, notes, and snippets.

Trying to stay in the right branch of the wave function.

Jon Schlinkert jonschlinkert

Trying to stay in the right branch of the wave function.
View GitHub Profile
View download-ballots.js
'use strict';
const download = require('download');
* Download all ballots
const dl = async (baseurl, dest) => {
const pending = [];
jonschlinkert / keybindings.json
Created Dec 7, 2020
VS Code - Open Keyboard Shortcuts (JSON) - Add the following key binding configuration to your `keybindings.json` file to automatically wrap angle brackets around selected text by typing "<".
View keybindings.json
// wrap a selection with angle brackets (<)
"key": "shift+,",
"command": "editor.action.insertSnippet",
"when": "editorHasSelection && editorTextFocus",
"args": {
"snippet": "<${0:${TM_SELECTED_TEXT}}$0>"
View vs-code-workspace-defaults.json5
// Editor
// Controls whether the editor shows CodeLens.
"diffEditor.codeLens": false,
// When enabled, the diff editor ignores changes in leading or trailing whitespace.
"diffEditor.ignoreTrimWhitespace": true,
// Timeout in milliseconds after which diff computation is cancelled. Use 0 for no timeout.
jonschlinkert /
Last active Nov 4, 2020
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).
jonschlinkert / recorder.js
Created Sep 4, 2019
Simple function for "recording" events and persisting them to the file system. Useful for debugging.
View recorder.js
'use strict';
const fs = require('fs');
const path = require('path');
module.exports = name => {
const datapath = path.join(__dirname, `${name}.json`);
const history = [];
const record = (input, key) => {
  • Begin with the user in mind
  • Check bug reports, and resolve any critical issues
  • Review yesterday's todo list
  • Create today's todo list
  • Announce todo list to team
  • Identify and discuss blockers
jonschlinkert / Makefile
Created Jul 6, 2019 — forked from mpneuried/Makefile
Simple Makefile to build, run, tag and publish a docker containier to AWS-ECR
View Makefile
# import config.
# You can change the default config with `make cnf="config_special.env" build`
cnf ?= config.env
include $(cnf)
export $(shell sed 's/=.*//' $(cnf))
# import deploy config
# You can change the default deploy config with `make cnf="deploy_special.env" release`
dpl ?= deploy.env
include $(dpl)
View async-string-replace.js
const replace = async (input, regex, replacer) => {
// we need to remove the 'g' flag, if defined, so that all replacements can be made
let flags = (regex.flags || '').replace('g', '');
let re = new RegExp(regex.source || regex, flags);
let index = 0;
let match;
while ((match = re.exec(input.slice(index)))) {
let value = await replacer(...match);
index += match.index;
jonschlinkert / try-open.js
Last active Jun 25, 2019
Simple way to open a file or directory in a text editor or file manager, whichever is resolved first.
View try-open.js
const cmds = { linux: 'xdg-open', win32: 'start', darwin: 'open' };
const open = cmds[process.platform];
const tryOpen = (dirname, editors = ['sublime', 'code', open]) => {
try {
cp.execSync([editors[0], dirname].join(' '));
console.log('Opening in ' + editors[0]);
} catch (err) {
if (editors.length === 0) {
throw new Error('Cannot find an editor to open');
jonschlinkert / open.js
Created Jun 25, 2019
Simple, cross-platform way to open the browser upon starting an app.
View open.js
const cp = require('child_process');
const Koa = require('koa');
const app = new Koa();
const cmds = { linux: 'xdg-open', win32: 'start chrome', darwin: 'open' };
const open = cmds[process.platform];
const PORT = 3000;
// response
app.use(ctx => {
ctx.body = 'Hello Koa';