Skip to content

Instantly share code, notes, and snippets.

@jjhamshaw
jjhamshaw / delete local git branches.sh
Last active September 13, 2017 13:44
scripts to clean up local git branches for a given repository
# safe delete branches
# (deletes all MERGED branches, except dev and master)
git branch --merged | grep -v "\*" | grep -v master | grep -v dev | xargs -n 1 git branch -d
# delete branches
# (deletes all branches, except dev and master)
git branch | grep -v "\*" | grep -v master | grep -v dev | xargs -n 1 git branch -D
@andrewdeandrade
andrewdeandrade / reverse_alphabetical_sort_in_backbone
Created May 1, 2011 04:10
Reverse Alphabetical Sort in Backbone.js
// Assumption: You have a model with a name.
comparator: function (User) {
if (User.get("name")) {
var str = User.get("name");
str = str.toLowerCase();
str = str.split("");
str = _.map(str, function(letter) { return String.fromCharCode(-(letter.charCodeAt(0))) });
return str;
};