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
// See https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Function/bind | |
// for a more verbose-but-standards-compliant version. | |
if (!Function.prototype.bind) { | |
Function.prototype.bind = function(context){ | |
var fn = this, args = [].slice.call(arguments, 1); | |
return function(){ | |
return fn.apply( context, args.concat([].call(arguments)) ); | |
}; | |
}; | |
} |
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 heapq | |
from collections import namedtuple | |
Point = namedtuple('x y z') | |
PointState = namedtuple('dist point') | |
class ClosestKPoints(object): |
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 fish | |
function fail | |
echo "FAIL. $argv" >&2 | |
exit 1 | |
end | |
not which python; and fail "Cannot find python on your path. Are you daft?" | |
set -l ver (python -c 'import sys; print sys.version[0:3]') |
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 | |
# Licensed to the Apache Software Foundation (ASF) under one | |
# or more contributor license agreements. See the NOTICE file | |
# distributed with this work for additional information | |
# regarding copyright ownership. The ASF licenses this file | |
# to you under the Apache License, Version 2.0 (the | |
# "License"); you may not use this file except in compliance | |
# with the License. You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 |
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
#! /bin/bash | |
function halp () { | |
cat <<-HALP | |
pylons -- Starts a Pylons app, creating logs and saving a pidfile. | |
Usage: $( basename $0 ) [INI_FILE] | |
If INI_FILE is not 'development.ini', stdout and stderr are redirected |
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(){ | |
/** | |
* Function.asyncChain( fn, [...] ) -> Function | |
* | |
* Takes any number of callback functions and returns a scheduler function | |
* which manages the chain. Each supplied callback to should take one | |
* argument, the scheduler, to execute with no arguments when it completes. | |
* | |
* Example: |
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
#!/bin/bash | |
function usage () { | |
echo | |
echo "Usage: $0 USERNAME COOKIES" | |
echo | |
echo "Easiest Way to Get Your Cookies:" | |
echo " I recommend you use firebug on a visit to http://www.flickr.com and copy the value of the Cookie header from your first request." | |
} |
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
#!/bin/bash | |
# usage: | |
# unshorten.sh 'http://bit.ly/95U1UY' | |
# echo 'http://bit.ly/95U1UY' | unshorten.sh | |
# | |
# author: [email protected] | |
if test "$1"; then |
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
#!/bin/bash | |
# @author [email protected] | |
if test "$1"; then | |
LONG_URL="$1" | |
else | |
read LONG_URL | |
fi | |
SHADY="http://www.shadyurl.com/create.php?myUrl=" |
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
'You see,' [the devil] says to me casually, 'the moth is way up there by the | |
white wall of the doorway, and it is visible only because it moves. From here it | |
almost looks like a bird high up in the sky, if you think of the wall as the | |
sky. That's probably how the moth sees the wall, and only we know it is wrong. | |
But it doesn't know that we know. It doesn't even know we exist. You try to | |
communicate with it, if you can. Can you tell it anything in a way it | |
understands; can you be sure it has understood you completely?' | |
'I don't know,' I replied. 'Can you?' |