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
COFFEEC = coffee | |
SASSC = sass | |
HANDLEBARSC = handlebars | |
# Build app package | |
APPSRC = static/scripts/main.coffee | |
APPOBJ = ${APPSRC:.coffee=.js} | |
APPOUT = static/scripts/app.js |
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
from functools import partial | |
from urllib2 import HTTPError | |
from simperium.core import Auth, Api | |
def setup(app_id, api_key): | |
class User(object): | |
_auth = Auth(app_id, api_key) | |
def __init__(self, username=None, password=None, token=None): |
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
Question: Convert following into the latter data structure in less than 30 lines: | |
List: | |
A, B, C | |
A, C, E | |
E, F, D | |
D, A, J | |
E, D, J | |
List |
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
import hashlib | |
from collections import namedtuple | |
import redis | |
import query | |
def _tag_keys(tags): | |
return [("txn:tag:%s" % tag) for tag in tags] | |
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
# autocomplete.py - Redis autocomplete example | |
# download female-names.txt from http://antirez.com/misc/female-names.txt | |
# Ruby original: http://gist.github.com/574044 | |
# Requires http://github.com/andymccurdy/redis-py/ | |
from redis import Redis | |
r = Redis() | |
KEY = 'compl' |
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 argparse | |
import sys | |
def tokenize(source): | |
return list(source) | |
def parse(tokens): |
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
<?php | |
function foo($a, $b) { | |
echo "a: {$a} b: {$b}\n"; | |
} | |
$foo_caller = new PartialCallable('foo', array('A')); | |
$foo_caller('B'); | |
$foo_caller = partial_function('foo', 'A'); | |
$foo_caller('B'); |
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/sh | |
set -e | |
# Kill any Mongrels that may be running | |
if [ -e "run/mongrel2.pid" ]; then | |
kill -9 `cat run/mongrel2.pid` | |
fi | |
# Start a new tmux session | |
needs_attached=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
source "$HOME/Code/git-sh/git-completion.bash" | |
git_prompt_info() { | |
branch_prompt=`echo "$(__git_ps1)" | sed -E "s/\((.+)\)/\1/g" | sed -Ee "s/^[ \t]+//"` | |
if [ -n "$branch_prompt" ]; then | |
status_icon=$(git_status) | |
echo " (± $branch_prompt$status_icon)" | |
fi | |
} |
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
Copyright (C) 2012 Justin Poliey <justin.d.poliey@gmail.com> | |
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | |
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | |
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WIT |