Skip to content

Instantly share code, notes, and snippets.

@outerpasta
outerpasta / gist:c6fcceee1686163bdc6b3a07cb5f92b9
Created May 3, 2016 18:28
remove untracked files from git repo
for i in $(git status -s | sed 's/\?\?//g'); do rm $i; done
# Delete git branches matching regex
git-delete-branches() {
git branch -D $(git branch | grep -E "$1")
}
# Checkout a temporary branch and commit changes. Like git stash but less easy to forget about.
alias tmp_commit='git checkout -b $(g rev-parse --abbrev-ref HEAD)_ && git add -u && git commit -m "$(git rev-parse --abbrev-ref HEAD): temporary commit."'
@outerpasta
outerpasta / gist:65dd37c215e062538bcc
Created July 3, 2014 16:54
Takes a dict with nested lists and dicts and searches all dicts for a key of the field provided.
def get_recursively(search_dict, field):
"""Takes a dict with nested lists and dicts,
and searches all dicts for a key of the field
provided.
"""
fields_found = []
for key, value in search_dict.iteritems():
if key == field: