Skip to content

Instantly share code, notes, and snippets.

Tony Pitale tpitale

Block or report user

Report or block tpitale

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@gvaughn
gvaughn / copr.md
Last active Jun 25, 2019
git copr alias
View copr.md

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
tpitale / README.md
Last active Jul 10, 2019
Sublime Text plugin to create a simple timestamp
View README.md
  1. Go to Tools > New Plugin
  2. Paste timestamp.py contents and save in User as timestamp.py
  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
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', 'https://github.com/titoBouzout/SideBarEnhancements', '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
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
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
block.call(
@kevingessner
kevingessner / gist:9509148
Last active Jun 3, 2019
Responsive emails that really work -- From Etsy's Code As Craft blog: http://codeascraft.com/2014/03/13/responsive-emails-that-really-work
View gist:9509148
<html>
<head>
<style type="text/css">
table table {
width: 600px !important;
}
table div + div { /* main content */
width: 65%;
float: left;
}
@tpitale
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)
FROM (
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
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
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 => 'https://accounts.google.com/o/oauth2/auth',
You can’t perform that action at this time.