Skip to content

Instantly share code, notes, and snippets.

@Dru89
Dru89 / gist:5510529
Created May 3, 2013 16:14
sample git hook for jekyll
GIT_REPO=$HOME/myrepo.git
TMP_GIT_CLONE=$HOME/tmp/myrepo
PUBLIC_WWW=/var/www/myrepo
git clone $GIT_REPO $TMP_GIT_CLONE
cd $TMP_GIT_CLONE
jekyll --no-auto $TMP_GIT_CLONE $PUBLIC_WWW
cd $HOME
rm -Rf $TMP_GIT_CLONE
exit
@Dru89
Dru89 / facebook_profiles.py
Created December 6, 2012 01:04
Display a list of names for people's user ids.
import json
import urllib2
facebook_ids = [] # Input ids here like ["1234567890", "1234567890", "1234567890", "1234567890"]
to_show = 15 # how many profiles do you want to see?
def get_name_for(id):
return json.loads(urllib2.urlopen("http://graph.facebook.com/{0}".format(id)).read())["name"]
@Dru89
Dru89 / prose.zsh
Created November 28, 2012 21:58
My ZSH Theme
# proze.zsh-theme
# Most of this was taken from http://stevelosh.com/blog/2010/02/my-extravagant-zsh-prompt/
# Determine what character to use in place of the '$' for my prompt.
function repo_char {
git branch >/dev/null 2>/dev/null && echo '☿' && return
echo '○'
}
# Display any virtual env stuff with python.
@Dru89
Dru89 / StringSwitch.java
Created July 28, 2011 20:57
Testing strings in switch statements with Java 1.7
public class StringSwitch {
public static void main(String... args) {
System.out.println("String x = new String(\"asdf\");");
System.out.println("String y = new String(\"asdf\");");
System.out.println("String z = \"asdf\";");
String x = new String("asdf");
String y = new String("asdf");
String z = "asdf";
System.out.format("x == y : %s\n", x==y ? "true" : "false");