Skip to content

Instantly share code, notes, and snippets.

View travist's full-sized avatar

Travis Tidwell travist

View GitHub Profile
@travist
travist / gist:1942541
Created February 29, 2012 17:12
Determine every event that gets fired on your page.
(function($) {
$('*').each(function() {
var e = $.data(this, 'events');
if(!e) return;
for(var p in e) {
$(this).bind(p, {event:p, name: this.tagName + '.' + this.className}, function(event) {
console.log(event.data.name + " triggered " + event.data.event);
});
};
});
@travist
travist / gist:1760058
Created February 7, 2012 14:50
Using GIT to determine all changes to a file provided a date range.
git log --shortstat --since="3 weeks ago" --until="now" \
| grep "Merge pull request" -B 5\
| awk '{\
if ($1=="commit") {\
output = system("git diff " $2 "^ " $2 " {YOUR FILE HERE}");\
if (output) {\
print output;\
}\
}\
}'
@travist
travist / gist:1677353
Created January 25, 2012 17:09
Determine the diff provided a Story ID.
git log\
| grep "Merge pull request.*{INSERT STORY ID HERE}" -B 5\
| awk '{\
if ($1=="commit") {\
print system("git diff " $2 "^ " $2);\
}\
}'
@travist
travist / gist:1672594
Created January 24, 2012 20:59
Determine all commits for a developer given a time range.
git log --shortstat --since="2011-9-1" --until="2011-11-15" \
| grep "commit\|Author\|Merge:" \
| awk '{\
if ($1 == "Merge:") {\
merge = 1;\
}\
if ($1 == "commit") {\
merge = 0;\
commit = $2;\
}\
@travist
travist / gist:1670749
Created January 24, 2012 15:41
.bashrc for bringing in GIT branches
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]:->$(__git_ps1 " (%s)")\$ '
@travist
travist / gist:1648952
Created January 20, 2012 18:45
Determine how productive your team has been using git history.
git log --shortstat --since="1 year ago" --until="now" \
| grep "files changed\|Author\|Merge:" \
| awk '{ \
if ($1 == "Author:") {\
currentUser = $2;\
}\
if ($2 == "files") {\
files[currentUser]+=$1;\
inserted[currentUser]+=$4;\
deleted[currentUser]+=$6;\