Skip to content

Instantly share code, notes, and snippets.

View tantalor's full-sized avatar

John Tantalo tantalor

View GitHub Profile
@tantalor
tantalor / graph.js
Created April 26, 2012 23:06
liquidGraph minimal no-solution
{"polys":[{"fillColor":"110-hsb(0.1820702975615859,0.7,1)-hsb(0.38207029756158595,0.9,1)","vertices":[{"x":0.0380517503805175,"y":0.25799086757990863},{"x":0.11643835616438353,"y":0.25722983257229837},{"x":0.13318112633181123,"y":0.21232876712328766},{"x":0.1582952815829528,"y":0.27853881278538817},{"x":0,"y":0.2808219178082192},{"x":0.1537290715372907,"y":0},{"x":0.33409436834094364,"y":0.2808219178082192},{"x":0.1811263318112633,"y":0.27929984779299843},{"x":0.20319634703196343,"y":0.21232876712328766},{"x":0.2161339421613394,"y":0.25494672754946723},{"x":0.29147640791476404,"y":0.258751902587519},{"x":0.1552511415525114,"y":0.04033485540334855}]}],"particles":[]}
@tantalor
tantalor / original.js
Created April 3, 2012 15:49
Mozilla Notification API
var notification = navigator.mozNotification;
if (notification && notification.requestRemotePermission) {
// Ask the user to allow notifications.
var request = notification.requestRemotePermission();
request.onsuccess = function() {
var url = request.result;
console.log('New push URL: ' + url);
// We got a new push URL, store it on the server.
jQuery.post('/push-urls/', {url: url});
};
@tantalor
tantalor / gist:2244383
Created March 29, 2012 22:27 — forked from jedsundwall/gist:2244379
hacking google spreadhseets
function makeURL(firstname,lastname) {
var name = firstname + lastname;
if (!name) {
return null;
} else {
return name;
}
}
@tantalor
tantalor / moon.html
Created March 12, 2012 22:25
Moon in px
<body style="background: black">
<a href="http://inamidst.com/stuff/notes/csspx">
<img src="http://upload.wikimedia.org/wikipedia/en/thumb/c/c9/Moon_nearside_LRO.jpg/170px-Moon_nearside_LRO.jpg" style="width:24.3px;height:24.3px">
</a>
import thor
thor.ssh()
@tantalor
tantalor / Custom.css
Created January 18, 2012 05:32
Wikipedia Blackout Blocker
#mw-page-base, #mw-head-base, #content,
#mw-head, #mw-panel, #footer {
display: block !important;
}
#mw-sopaOverlay {
display: none !important;
}
@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 / 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;