This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import os | |
import argparse | |
import logging | |
import datetime | |
import urlparse | |
import subprocess | |
logging.basicConfig(level=logging.INFO) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* bounceserver.js | |
* License: MIT (http://www.opensource.org/licenses/mit-license.php/) | |
* Author: Jason Feinstein (jason.feinstein@gmail.com) | |
* | |
* Instructions: | |
* 1. Install node.js: http://nodejs.org | |
* 2. run this file, listing the bounce addresses like so: | |
* node bounceserver.js http://mybounceaddress:1111/ http://google.com | |
* 3. Start sending requests to the server. They will be bounced properly! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def random_string(n_chars): | |
'''Generates a random string of length n_chars. | |
>>> random_string(5) | |
'FM>ro' | |
>>> random_string(8) | |
'"K^V]J|/' | |
>>> random_string(32) | |
')tTu,2"s`ke`MF0}qWd.-&__C8OEksQy' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(){ | |
var callback = function(){}, | |
callbackName = 'gmapscallback'+(new Date()).getTime(); | |
window[callbackName] = callback; | |
define(['http://maps.googleapis.com/maps/api/js?sensor=true&callback=' + callbackName], function(){ | |
return google.maps; | |
}); | |
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name TL Trac Beautifier | |
// @namespace https://dev.transloc.com | |
// @description Makes Trac look much better. | |
// @include https://dev.transloc.com/* | |
// ==/UserScript== | |
var $; | |
// Add jQuery |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function debounce(fn, debounceDuration){ | |
// summary: | |
// Returns a debounced function that will make sure the given | |
// function is not triggered too much. | |
// fn: Function | |
// Function to debounce. | |
// debounceDuration: Number | |
// OPTIONAL. The amount of time in milliseconds for which we | |
// will debounce the function. (defaults to 100ms) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
define(function(){ | |
var instance = null; | |
function MySingleton(){ | |
if(instance !== null){ | |
throw new Error("Cannot instantiate more than one MySingleton, use MySingleton.getInstance()"); | |
} | |
this.initialize(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function fadeOut(line, keepAround, fadeDuration){ | |
keepAround = keepAround || 1000; | |
fadeDuration = fadeDuration || 500; | |
setTimeout(function(){ | |
var startingOpacity = line.strokeOpacity, | |
startTime = (new Date()).getTime(); | |
function step(){ | |
var currentTime = (new Date()).getTime(), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Triggers the 'onresize' event for the window manually. | |
if(document.createEventObject){ | |
window.fireEvent('onresize', document.createEventObject()); | |
} else { | |
var evt = document.createEvent("HTMLEvents"); | |
evt.initEvent('resize', true, true); | |
window.dispatchEvent(evt); | |
} |