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
# Prevent pip from doing anything unless you're inside an activated virtualenv. | |
PIP=/usr/local/bin/pip | |
function pip { | |
if [ "x$VIRTUAL_ENV" = 'x' ]; then | |
echo "No virtualenv activated; bailing." | |
else | |
PIP -E `basename $VIRTUAL_ENV` "$@" | |
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
#!/bin/bash | |
# This hook is run after every virtualenv is activated. | |
alias dj='python manage.py' | |
alias djr='dj runserver 0.0.0.0:8000' | |
alias djdb='dj dbshell' | |
alias djs='dj shell' | |
alias djt='dj test' |
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 django.contrib.auth.models import User | |
from django_automcomplete import Autocomplete | |
class UserAutocomplete(Autocomplete): | |
fields = ('username',) | |
class Meta: | |
models = User |
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
open -a /Applications/Google\ Chrome.app --args --disable-web-security |
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
browsesecure() { | |
python <<SWITCH | |
import sys | |
from subprocess import Popen, call, PIPE | |
import time | |
def switch_location(name): | |
call(['scselect', name], stdout=open('/dev/null', 'w')) | |
print "Switched to %s" % name |
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 hotshot | |
import os | |
import time | |
try: | |
PROFILE_LOG_BASE = settings.PROFILE_LOG_BASE | |
except: | |
PROFILE_LOG_BASE = "/tmp" | |
def profile(log_file): |
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
PROJECT_DIR="$(dirname "${BASH_SOURCE:-$0}" )"; | |
ABSOLUTE_DIR=`$SHELL -c "cd \"$PROJECT_DIR\" && pwd"`; | |
PROJECT_NAME="$( basename $ABSOLUTE_DIR)"; | |
if [[ -n $PROJECT_NAME && $VIRTUAL_ENV != *"$PROJECT_NAME" ]]; | |
then workon $PROJECT_NAME; | |
fi; | |
unset PROJECT_DIR; | |
unset ABSOLUTE_DIR; |
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 django.db import models | |
from django.utils.functional import curry | |
def contribute_to_model(contrib, destination): | |
""" | |
Update ``contrib`` model based on ``destination``. | |
Every new field will be created. Existing fields will have some properties | |
updated. |
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
var seconds = 60 | |
locache.set("key", { | |
'user': 1, | |
'books': ['a', 'b', 'c'] | |
}, seconds) | |
locache.get("key") | |
// {'user': 1, 'books': ['a', 'b', 'c']} | |
// Note the object is returned, not a string. |
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
➜ ~ brew install glib | |
==> Installing glib dependency: gettext | |
==> Downloading http://ftpmirror.gnu.org/gettext/gettext-0.18.1.1.tar.gz | |
Already downloaded: /Library/Caches/Homebrew/gettext-0.18.1.1.tar.gz | |
==> Downloading patches | |
######################################################################## 100.0% | |
######################################################################## 100.0% | |
==> Patching | |
patching file gettext-tools/configure | |
patching file gettext-tools/Makefile.in |
OlderNewer