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
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"); |
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
# 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. |
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
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"] |
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
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 |
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
module Jekyll | |
LIQUIDY_TAGS = ['{{', '}}', '{%', '%}'] | |
class StaticFile | |
def is_liquidy | |
case File.extname(self.path) | |
when '.html' | |
text = File.read(self.path) | |
LIQUIDY_TAGS.any? { |tag| text.include? tag } | |
else |
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
ORIGIN_GIT_REPO=/path/to/my/origin/repo.git | |
############################### | |
# Method 1: You don't care if the clone is a repo, you just want the files | |
# (useful for builds/etc that you aren't manually working with) | |
TMP_GIT_CLONE=/path/to/local/clone | |
git clone $GIT_REPO $TMP_GIT_CLONE | |
# if you do some build logic, it could go here like: | |
# cd $TMP_GIT_CLONE/ |
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
# 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. | |
function virtualenv_info { |
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
# Get all the images from http://xkcd.com/1416/ | |
import urllib2 | |
import json | |
ids = [] | |
def process(id): | |
if id in ids: return | |
ids.append(id) |
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
{ | |
"no_backticks": { | |
"level" : "ignore" | |
}, | |
"no_tabs" : { | |
"level" : "error" | |
}, | |
"no_trailing_whitespace" : { |
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
import argparse | |
import os | |
import re | |
import sys | |
from collections import defaultdict, Counter | |
from copy import deepcopy | |
EXAMPLE_PUZZLE = [ | |
['n', 'e', 'e', 't'], |
OlderNewer