Skip to content

Instantly share code, notes, and snippets.

View jcantrell-trulia's full-sized avatar

JD Cantrell jcantrell-trulia

View GitHub Profile
@jcantrell-trulia
jcantrell-trulia / lspace.py
Created June 10, 2013 07:07
Learning about the best ways to find file names given a partial match. So regex =bad, .find = okay-ish, PartialTrie = awesome but unholy ram usuage.
import re
import timeit
global cache_list
class PartialTrie:
def __init__(self):
self.leaf = False
self.tries = {}
#!/usr/bin/python
import re,sys
username = sys.argv[1]
for line in sys.stdin:
break
fh = open('.htaccess_mobile')
for line in fh:
@jcantrell-trulia
jcantrell-trulia / .bashrc
Created April 25, 2013 18:43
Git Prompt for bash
_git_info() {
ref=$(git symbolic-ref HEAD 2> /dev/null) || return
echo "${ref#refs/heads/} "
}
# Checks if working tree is dirty
_git_dirty() {
if [[ -n $(git status -s --ignore-submodules=dirty 2> /dev/null) ]]; then
#dirty
echo -e $GIT_DIRTY