Skip to content

Instantly share code, notes, and snippets.

mager / index.html
Created Oct 15, 2010
This is an example of SimpleGeo's GeoIP functionality for getting the user's location based on IP address. This example uses Polymaps.
View index.html
<!DOCTYPE html>
<script type="text/javascript">
var simplegeo=(function(b,d){var c=(function(k,g){function e(){return(new Date).getTime()}var m=k.document;var n=e(),i=/=\?(&|$)/,j=/(\?|&)_=.*?(&|$)/,l=/\?/,h=/%20/g,f=Object.prototype.toString,o={isFunction:function(p){return"[object Function]"},isArray:function(p){return"[object Array]"},each:function(s,w,r){var q,t=0,u=s.length,p=u===g||o.isFunction(s);if(r){if(p){for(q in s){if(w.apply(s[q],r)===false){break}}}else{for(;t<u;){if(w.apply(s[t++],r)===false){break}}}}else{if(p){for(q in s){if([q],q,s[q])===false){break}}}else{for(var v=s[0];t<u&&,t,v)!==false;v=s[++t]){}}}return s},param:function(p){var q=[];if(o.isArray(p)||p.jquery){o.each(p,function(){u(,this.value)})}else{for(var t in p){r(t,p[t])}}return q.join("&").replace(h,"+");function r(s,v){if(o.isArray(v)){o.each(v,function(x,w){if(/\[\]$/.test(s)){u(s,w)}else{r(s+"["+(typeof w==="object"||o.isArray(w)?x:"")+"]",w)}})}else{if(v!=n
View debug.js
require.registerExtension('.js', function(js){
return js.replace(/^ *\/\/debug: */gm, '');
View failure-detector.js
// Based on
function FailureDetector(ws) {
// ws stands for window size.
// How many heartbeat intervals we keep track of. = ws || 100;
this.window = [];
this.last = null;
exports.FailureDetector = FailureDetector;
eonnen / gist:2647948
Created May 9, 2012
Sample ZK Configuration
View gist:2647948
# The number of milliseconds of each tick
# The number of ticks that the initial
# synchronization phase can take
# The number of ticks that can pass between
# sending a request and getting an acknowledgement
# the directory where the snapshot is stored.
holman /
Created Oct 15, 2012
Dropbox is cray

Hi Zach,

We’re working to make it easier for your Dropbox for Teams administrators to manage all the stuff you and your teammates have in your Teams account. Soon, we’ll be releasing new features for admins to manage the security of your team’s stuff and make it easier for them to help when things go wrong.

In some cases, your admin may need the flexibility to take some actions on your Teams account, such as helping to manage shared folders or restoring access if you get locked out of your account. In order to clarify that admins may have access to team member accounts when managing the team, we're updating our Dropbox for Teams Agreement and Privacy Policy.

You might have some personal files in your Teams account that you’d like to move to a personal account. For example, if you want to keep vacation pictures in a different account from your latest Excel spreadsheet, you can use this online guide to move your files:

View the new agreement and get started here

pearkes / gist:4069203
Created Nov 13, 2012
My shell prompt, with Vagrant and Git status.
View gist:4069203
# Example:
prompt() {
PS1="${GREEN}\W\$(parse_git_branch) $BROWN\$(parse_vm_state) ${GREEN}${GREY}"
PS2="\[[33;1m\]continue \[[0m[1m\]> "
parse_git_branch() {
howeyc / watchalldirs.go
Created Feb 12, 2013
Watch for created directories.
View watchalldirs.go
package main
import (
rcrowley /
Created Jul 18, 2013
How to get a reservation at State Bird Provisions
set -e
mail() {
echo "$@" |
/usr/bin/mail -a"From: Richard Crowley <>" -s"State Bird Provisions" ""
echo "$(date): there was a reservation!" >&2
trap "mail \"FAILURE\"; rm -f \"$TMP\"" EXIT INT QUIT TERM
View example.js
// jshint unused:false
/* global console */
var num = 1,
flt = 2.1,
neg = -1,
hex = 0xFF2200,
octal = -01234,
nan = NaN,
nll = null,
# In-memory Cassandra-ish thingy... useful for unit tests. Maybe useful for other
# stuff too? No support for SuperColumns, but that should be easy enough to add.
import bisect
import copy
from cassandra.ttypes import NotFoundException, Column, ColumnPath, ColumnOrSuperColumn
class SSTable(object):
You can’t perform that action at this time.