Skip to content

Instantly share code, notes, and snippets.

View tantalor's full-sized avatar

John Tantalo tantalor

View GitHub Profile
@tantalor
tantalor / go.js
Created October 10, 2011 03:40
Prime sieve in Go-flavored JavaScript
#!/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 October 3, 2011 16:09
Perl script to URI-escape JavaScript for bookmarklets
#!/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 April 20, 2011 23:43
buffering asynchronous iterator pattern
// 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) {
{"html": "line<br>break"}
@tantalor
tantalor / bliff.pl
Created March 12, 2011 03:07
Combines svn blame and diff.
#!/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 February 15, 2011 00:03
Starcraft 2 counters for basic units (node)
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 January 27, 2011 01:04
A perl quine.
#!/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;
<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;
// 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;
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