Last active
January 14, 2020 08:09
-
-
Save remy/4654404 to your computer and use it in GitHub Desktop.
Run this in the console of your github.com/<user> page (i.e. http://github.com/remy) and see how many weekends you were in front of a computer and committing code instead of taking a break.
This file contains hidden or 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
$.getJSON('https://github.com/users/' + location.pathname.replace(/\//g, '') + '/contributions_calendar_data', weekendWork); | |
function weekendWork(contribs) { | |
var inwe = false, streak = 0, highest = 0, total = 0, possible = 0; | |
contribs.forEach(function (c) { | |
var d = new Date(c[0]).getDay(); | |
if (d === 6) { | |
inwe = true; | |
} else if (d === 0 && inwe) { | |
possible++; | |
if (c[1] !== 0) { | |
total++; | |
streak++; | |
if (streak > highest) highest = streak; | |
} else { | |
streak = 0; | |
} | |
} else { | |
inwe = false; | |
} | |
}); | |
console.log('Potential weekends relaxing: ' + possible + ', total weekends working: ' + total + ', number of weekends IN A ROW working: ' + highest); | |
if (highest > 0) console.log('Take a break. Have a kitkat'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm sure there IS something wrong with the results, my graph is obviously much more scattered than this message:
Potential weekends relaxing: 53, total weekends working: 53, number of weekends IN A ROW working: 53
Take a break. Take a kitkat