Skip to content

Instantly share code, notes, and snippets.

John Tantalo tantalor

Block or report user

Report or block tantalor

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
tantalor /
Created May 5, 2014
Merge Algorithm
def merge(streams):
# Keep track of the least value in each stream.
head = [ for stream in streams]
while len(head):
# Yield the least value of all streams.
next = min(head)
yield next
index = head.index(next)
# Get next value from that stream.
def bin(x, k=0):
d = {0:'000', 1:'001', 2:'010', 3:'011', 4:'100', 5:'101', 6:'110', 7:'111'}
return ''.join([d[int(dig)] for dig in oct(x)]).lstrip('0').zfill(k)
View ipa.bookmarklet.js
View chain.jquery.js
// John Tantalo
jQuery.fn.chain = function (fn)
var self = this;
return function ()
if (!self.size()) return;
fn(self.eq(0), self.slice(1).chain(fn));
View svnclean
alias svnclean="for i in \$(svn st | grep \? | cut -c 9-); do echo \$i && rm \$i; done"
View .screenrc_ssh
escape ``
screen -t "host 1" ssh host1
screen -t "host 1" ssh host1
screen -t "host 2" ssh host2
screen -t "host 2" ssh host2
screen -t "host 3" ssh host3
screen -t "host 3" ssh host3
View slideshow.html
<div id="slideshow">
<img src="">
<img src="" style="display:none">
<img src="" style="display:none">
<img src="" style="display:none">
<img src="" style="display:none">
<script type="text/javascript">
var ims = document.getElementById('slideshow').children;
tantalor / counters.js
Created Feb 15, 2011
Starcraft 2 counters for basic units (node)
View counters.js
ZERGLING = 'Zergling',
ROACH = 'Roach',
HYDRALISK = 'Hydralisk',
BANELING = 'Baneling',
MARINE = 'Marine',
HELLION = 'Hellion',
MARAUDER = 'Marauder',
REAPER = 'Reaper',
TANK = 'Siege Tank',
tantalor /
Created Mar 12, 2011
Combines svn blame and diff.
use strict;
use List::Util 'max';
my ($from, $to) = @ARGV
or die "usage: $0 OLD-URL[\@OLDREV] NEW-URL[\@NEWREV]\n";
my @diff = `svn diff $from $to` or die;
my @blame = map {/^\s*(\d+)/} `svn blame $to` or die;
View html.js
{"html": "line<br>break"}
You can’t perform that action at this time.