This file contains hidden or 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
#### automatically activate virtualenvs named 'pyenv' | |
#### just put this at the end of your ~/.bashrc file | |
workon_virtualenv() { | |
if [ -e "${PWD}/pyenv" ]; then | |
deactivate >/dev/null 2>&1 | |
source "${PWD}/pyenv/bin/activate" | |
fi | |
} | |
virtualenv_cd() { |
This file contains hidden or 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
#### automatically activate virtualenvs - from http://toranbillups.com/blog/archive/2012/4/22/Automatically-activate-your-virtualenv | |
workon_virtualenv() { | |
if [ -e "${PWD}/pyenv" ]; then | |
deactivate >/dev/null 2>&1 | |
source "${PWD}/pyenv/bin/activate" | |
fi | |
} | |
virtualenv_cd() { | |
cd "$@" && workon_virtualenv |
This file contains hidden or 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 init(){ | |
// do some stuff to the DOM | |
} | |
if (document.addEventListener) { | |
document.addEventListener('DOMContentLoaded', init, false); | |
} else { | |
window.onload = init; | |
} |
This file contains hidden or 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 | |
# Shell script to install your public key on a remote machine | |
# Takes the remote machine name as an argument. | |
# Obviously, the remote machine must accept password authentication, | |
# or one of the other keys in your ssh-agent, for this to work. | |
ID_FILE="${HOME}/.ssh/id_rsa.pub" | |
if [ "-i" = "$1" ]; then |
This file contains hidden or 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 | |
####### | |
# My .bash_profile | |
####### | |
export LANG=en_US.UTF-8 | |
parse_git_branch() { | |
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\ \1/' |
This file contains hidden or 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
#!/opt/pypy/bin/pypy | |
# easy project refactoring. | |
import os | |
import shutil | |
from subprocess import Popen | |
def build_parser(): | |
""" |
This file contains hidden or 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
// based on http://www.simonwhatley.co.uk/parsing-twitter-usernames-hashtags-and-urls-with-javascript | |
String.prototype.parseTweet = function(){ | |
return this | |
.replace(/[A-Za-z]+:\/\/[A-Za-z0-9-_]+\.[A-Za-z0-9-_:%&~\?\/.=]+/g, function(url) { | |
return url.link(url); | |
}) | |
.replace(/[@]+[A-Za-z0-9-_]+/g, function(u) { | |
var username = u.replace("@","") | |
return u.link("http://twitter.com/"+username); |
NewerOlder