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
tantalor / go.js
Created Oct 10, 2011
Prime sieve in Go-flavored JavaScript
View go.js
#!/usr/bin/env node
var sys = require('sys');
function go (fn) {
setTimeout(fn, 0);
};
var chan = function () {
this.readers = []; // [cb, ...]
@tantalor
tantalor / javascript_bookmarklet_builder.pl
Created Oct 3, 2011
Perl script to URI-escape JavaScript for bookmarklets
View javascript_bookmarklet_builder.pl
#!/usr/bin/env perl
#
# Written by John Gruber, taken with permission from:
# http://daringfireball.net/2007/03/javascript_bookmarklet_builder
use strict;
use warnings;
use URI::Escape qw(uri_escape_utf8);
use open IO => ":utf8", # UTF8 by default
":std"; # Apply to STDIN/STDOUT/STDERR
@tantalor
tantalor / generator.js
Created Apr 20, 2011
buffering asynchronous iterator pattern
View generator.js
// produce: accepts a cb which is called with an array of items
// initial: initial array of results to return
// returns a function which accepts a cb which is called with one item
// each time it is called
function generator(produce, initial) {
var items;
var waiting = [];
var next = function (cb) {
if (items && items.length) {
View html.js
{"html": "line<br>break"}
@tantalor
tantalor / bliff.pl
Created Mar 12, 2011
Combines svn blame and diff.
View bliff.pl
#!/usr/bin/perl
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;
@tantalor
tantalor / counters.js
Created Feb 15, 2011
Starcraft 2 counters for basic units (node)
View counters.js
var
ZERGLING = 'Zergling',
ROACH = 'Roach',
HYDRALISK = 'Hydralisk',
BANELING = 'Baneling',
MARINE = 'Marine',
HELLION = 'Hellion',
MARAUDER = 'Marauder',
REAPER = 'Reaper',
TANK = 'Siege Tank',
@tantalor
tantalor / quine.pl
Created Jan 27, 2011
A perl quine.
View quine.pl
#!/usr/bin/perl
my ($q, $n) = ("'", chr(10));
my $s = '#!/usr/bin/perl%smy ($q, $n) = ("%s", chr(10));%smy $s = %s%s%s;%sprintf $s, $n, $q, $n, $q, $s, $q, $n, $n;%s';
printf $s, $n, $q, $n, $q, $s, $q, $n, $n;
View slideshow.html
<div id="slideshow">
<img src="http://farm6.static.flickr.com/5243/5373962623_0e23ed169b_t.jpg">
<img src="http://farm6.static.flickr.com/5007/5374562138_30e01a767f_t.jpg" style="display:none">
<img src="http://farm6.static.flickr.com/5288/5374562162_d48ca16567_t.jpg" style="display:none">
<img src="http://farm6.static.flickr.com/5084/5374562208_3e1bbe58cc_t.jpg" style="display:none">
<img src="http://farm6.static.flickr.com/5086/5374562182_5ec5c14403_t.jpg" style="display:none">
</div>
<script type="text/javascript">
var ims = document.getElementById('slideshow').children;
View github.jquery.js
// http://aboutcode.net/2010/11/11/list-github-projects-using-javascript.html
jQuery.githubUser = function(username, callback) {
jQuery.getJSON("http://github.com/api/v1/json/" + username + "?callback=?", callback);
}
jQuery.fn.loadRepositores = function(username) {
this.html("<span>Querying GitHub for repositories...</span>");
var target = this;
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
You can’t perform that action at this time.