Skip to content

Instantly share code, notes, and snippets.

gvaughn /
Last active Jan 13, 2020
git copr alias

I'd like to share some git aliases that you might find useful if you handle pull requests from others.

Add these to your ~/.gitconfig in the [alias] section:

copr = "!f() { git fetch -fu origin refs/pull/$1/head:pr-$1; git checkout pr-$1; } ; f"
prunepr = "!git for-each-ref refs/heads/pr-* --format='%(refname:short)' | while read ref ; do git branch -D $ref ; done"

Now you can "git copr #{pr_number}" (check out pull request is the mnemonic) and it will pull down the PR in a local branch of pr-#{pr_number} and check it out for you. To do it right, you must pronounce it "Copper" with a James Cagney gangster accent.

tpitale /
Last active Jan 4, 2021
Sublime Text plugin to create a simple timestamp
  1. Go to Tools > New Plugin
  2. Paste contents and save in User as
  3. Open Preferences > Key Bindings - User (or Default, your call)
  4. Paste keybindings.json, or add a line to your keybindings
  5. Customize the keyboard shortcut to your liking and save
tpitale / gist:93428db182dd44ec52e5
Created Jun 11, 2014
SideBarEnhancement for ST2
View gist:93428db182dd44ec52e5
import os; path=sublime.packages_path(); (os.makedirs(path) if not os.path.exists(path) else None); window.run_command('exec', {'cmd': ['git', 'clone', '', 'SideBarEnhancements'], 'working_dir': path})
import os; path=sublime.packages_path(); window.run_command('exec', {'cmd': ['git', 'checkout', '37429739a0452a2dc36343fb7875ba7fcbeb88a9'], 'working_dir': os.path.join(path, 'SideBarEnhancements')})
tpitale / data.tsv
Created May 29, 2014
Minimally responsive (flexible width) D3 Bar Chart
View data.tsv
letter frequency
A .08167
B .01492
C .02782
D .04253
E .12702
F .02288
G .02015
H .06094
I .06966
tpitale / wait_for_notify.rb
Last active Aug 29, 2015
Implementation of wait_for_notify with PG and Celluloid::IO
View wait_for_notify.rb
def wait_for_notify(&block)
io = pg_connection.socket_io
while @listening do
Celluloid::IO.wait_readable(io) # blocks execution, but unblocks this actor
pg_connection.consume_input # fetch any input on this connection
# read the NOTIFY messages off the socket
while notification = pg_connection.notifies do
kevingessner / gist:9509148
Last active Mar 27, 2020
Responsive emails that really work -- From Etsy's Code As Craft blog:
View gist:9509148
<style type="text/css">
table table {
width: 600px !important;
table div + div { /* main content */
width: 65%;
float: left;
tpitale / group_and_count_to_date.sql
Last active Aug 29, 2015
Group count by creation date and sum of count-to-date.
View group_and_count_to_date.sql
SELECT created_on, note_count, sum(note_count) OVER (ORDER BY created_on ASC)
SELECT date_trunc('day', created_at) AS created_on, count(1) AS note_count
FROM notes
GROUP BY created_on
ORDER BY created_on DESC
) AS note_counting;
-- WHERE created_on >= '2013-01-01'
tpitale / ruby-example-upstart.conf
Created Jan 3, 2014
Basic start/stop upstart init conf for a ruby script. May require modification to run in /bin/bash or if you need to source rbenv or chruby.
View ruby-example-upstart.conf
# /etc/init/ruby-example-upstart.conf
description "Ruby example upstart conf"
# change to the user you want to run this ruby script as
setuid deploy
setgid deploy
# This starts upon bootup and stops on shutdown
# check runlevel of running system with `runlevel` command
tpitale / demo.rb
Created Jul 15, 2013
Test/demo script for Legato Issue #34
View demo.rb
#!/usr/bin/env ruby -Ilib
require 'pp'
require 'oauth2'
require 'legato'
module OAuth2Helpers
def build_client(id, secret)
opts = {
:authorize_url => '',