Skip to content

Instantly share code, notes, and snippets.

View jdx's full-sized avatar
⚜️
mise-en-place!

jdx

⚜️
mise-en-place!
View GitHub Profile
# this is an example "usage" definition
# it defines a subset of the tool "rtx". What syntax it uses for CLI arguments
# as well as how it interacts with env vars and config files
# usage can be thought of as "swagger for CLIs"
# The purpose is that having a language-agnostic definition for CLIs we can
# build tools like generic autocompletion (so you don't need to learn how to write complex bash/zsh completions)
# It would also allow us to build documentation tools (browser or CLI), scaffold out CLIs, and build
# parsing/validation libraries to make CLI development faster.
# CLI parsing starts here. This is close, but probably not identical to docopt.
#!/bin/bash
set -euxo pipefail
# Downloads a node tarball from https://nodejs.org/dist/ and extracts just
# the binary into the current directory. Chiefly we use this to get a node
# binary for uploading to manifold.
if [[ $# -ne 4 ]]; then
echo "USAGE: $0 <node_version> <os> <arch> <filename>"
exit 1
--- Actions ---
$Copy <M-C>
$Cut <M-X> <S-Del>
$Delete <Del> <BS> <M-BS>
$LRU
$Paste <M-V>
$Redo <M-S-Z> <A-S-BS>
$SearchWeb
$SelectAll <M-A>
$Undo <M-Z>
@jdx
jdx / request.js
Last active August 29, 2015 14:24
simple node json http request function with promises and no dependencies
'use strict';
let http = require('http');
let https = require('https');
let parseUrl = require('url').parse;
function concat (stream, callback) {
var strings = [];
stream.on('data', function (data) {
strings.push(data);
@17twenty
17twenty / simple_git.md
Created September 27, 2013 18:32
A Simple Git branching model

a simple git branching model

This is a very simple git workflow. It (and variants) is in use by many people. I settled on it after using it very effectively at Athena. GitHub does something similar; Zach Holman mentioned it in this talk.

The gist

if ! $(psql template1 -c 'SHOW SERVER_ENCODING' | grep -q UTF8); then
psql postgres -c "update pg_database set datallowconn = TRUE where datname = 'template0';"
psql template0 -c "update pg_database set datistemplate = FALSE where datname = 'template1';"
psql template0 -c "drop database template1;"
psql template0 -c "create database template1 with template = template0 encoding = 'UTF8';"
psql template0 -c "update pg_database set datistemplate = TRUE where datname = 'template1';"
psql template1 -c "update pg_database set datallowconn = FALSE where datname = 'template0';"
fi
@jdx
jdx / dickeyxxx.zsh-theme
Created December 12, 2012 21:13
dickeyxxx zsh theme
# Example:
#
# dickeyxxx@dickey-mbp ~/proj/tapjoykc 1.9.3-p194 (routes ✔)
# ✗✗✗
if [[ $TERM = *256color* || $TERM = *rxvt* ]]; then
turquoise="%F{81}"
orange="%F{166}"
purple="%F{135}"
hotpink="%F{161}"
@geemus
geemus / heroku.md
Created October 12, 2011 22:17
heroku style guide

TODO empty arrays and/or nil values (see apps:info)

General Guidelines

  • Use full sentences, including punctuation.
  • Labels should be provided where needed in the form of 'Labels labels:'.
  • Commands should have one newline between the header and body and another after the body.
  • Alpha-sort arrays before display and display labeled data in alpha-sorted key order.