Last active
December 10, 2015 22:18
-
-
Save aereal/4501019 to your computer and use it in GitHub Desktop.
Run this $GITHUB_HOST/$owner/$repo/graphs/contributors
This file contains 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
javascript:var%20$additions,$averages,$changes,$cmeta,$commits,$contributors,$deletions,$people,$person,createAverageChangesPerCommit,name,parseCommaSeparatedNumeral,person,totalCommits,_i,_len,_ref;parseCommaSeparatedNumeral=function(csn)%7Breturn%20parseInt(csn.replace(/,/,%22%22))%7D;createAverageChangesPerCommit=function($changes,commitCount)%7Bvar%20$averageNode,$lpc,averageLines,changedLines;changedLines=parseCommaSeparatedNumeral($changes.text());averageLines=changedLines/commitCount;$lpc=$(document.createElement(%22abbr%22)).attr(%7Btitle:%22lines%20per%20commit%22%7D).text(%22lpc%22);$averageNode=$(document.createElement(%22span%22)).css(%7Bcolor:$changes.css(%22color%22)%7D).text(%22%22+Math.round(averageLines)+%22%20%22).append($lpc);return%20$(document.createElement(%22span%22)).text(%22%20/%20%22).append($averageNode)%7D;$contributors=$(%22%23contributors%22);$people=$contributors.find(%22.person%22);_ref=$people.get();for(_i=0,_len=_ref.length;_i%3C_len;_i++)%7Bperson=_ref[_i];$person=$(person);$commits=$person.find(%22.cmt%22);$additions=$person.find(%22.a%22);$deletions=$person.find(%22.d%22);$cmeta=$person.find(%22.cmeta%22);name=$person.find(%22.aname%22).text();totalCommits=parseCommaSeparatedNumeral($commits.text());$averages=function()%7Bvar%20_j,_len1,_ref1,_results;_ref1=[$additions,$deletions];_results=[];for(_j=0,_len1=_ref1.length;_j%3C_len1;_j++)%7B$changes=_ref1[_j];_results.push(createAverageChangesPerCommit($changes,totalCommits))%7Dreturn%20_results%7D();$cmeta.append($averages)%7D;void(0) |
This file contains 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
parseCommaSeparatedNumeral = (csn) -> | |
parseInt(csn.replace(/,/, '')) | |
createAverageChangesPerCommit = ($changes, commitCount) -> | |
changedLines = parseCommaSeparatedNumeral($changes.text()) | |
averageLines = changedLines / commitCount | |
$lpc = $(document.createElement('abbr')).attr(title: 'lines per commit').text('lpc') | |
$averageNode = $(document.createElement('span')).css(color: $changes.css('color')).text("#{Math.round(averageLines)} ").append($lpc) | |
$(document.createElement('span')).text(' / ').append($averageNode) | |
$contributors = $('#contributors') | |
$people = $contributors.find('.person') | |
for person in $people.get() | |
$person = $(person) | |
$commits = $person.find('.cmt') | |
$additions = $person.find('.a') | |
$deletions = $person.find('.d') | |
$cmeta = $person.find('.cmeta') | |
name = $person.find('.aname').text() | |
totalCommits = parseCommaSeparatedNumeral($commits.text()) | |
$averages = | |
createAverageChangesPerCommit($changes, totalCommits) for $changes in [$additions, $deletions] | |
$cmeta.append($averages) |
This file contains 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
var $additions, $averages, $changes, $cmeta, $commits, $contributors, $deletions, $people, $person, createAverageChangesPerCommit, name, parseCommaSeparatedNumeral, person, totalCommits, _i, _len, _ref; | |
parseCommaSeparatedNumeral = function(csn) { | |
return parseInt(csn.replace(/,/, '')); | |
}; | |
createAverageChangesPerCommit = function($changes, commitCount) { | |
var $averageNode, $lpc, averageLines, changedLines; | |
changedLines = parseCommaSeparatedNumeral($changes.text()); | |
averageLines = changedLines / commitCount; | |
$lpc = $(document.createElement('abbr')).attr({ | |
title: 'lines per commit' | |
}).text('lpc'); | |
$averageNode = $(document.createElement('span')).css({ | |
color: $changes.css('color') | |
}).text("" + (Math.round(averageLines)) + " ").append($lpc); | |
return $(document.createElement('span')).text(' / ').append($averageNode); | |
}; | |
$contributors = $('#contributors'); | |
$people = $contributors.find('.person'); | |
_ref = $people.get(); | |
for (_i = 0, _len = _ref.length; _i < _len; _i++) { | |
person = _ref[_i]; | |
$person = $(person); | |
$commits = $person.find('.cmt'); | |
$additions = $person.find('.a'); | |
$deletions = $person.find('.d'); | |
$cmeta = $person.find('.cmeta'); | |
name = $person.find('.aname').text(); | |
totalCommits = parseCommaSeparatedNumeral($commits.text()); | |
$averages = (function() { | |
var _j, _len1, _ref1, _results; | |
_ref1 = [$additions, $deletions]; | |
_results = []; | |
for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) { | |
$changes = _ref1[_j]; | |
_results.push(createAverageChangesPerCommit($changes, totalCommits)); | |
} | |
return _results; | |
})(); | |
$cmeta.append($averages); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
See example: