Created
March 25, 2012 02:04
-
-
Save knowtheory/2190733 to your computer and use it in GitHub Desktop.
A quick script for totaling up how much time it'd take to watch through a coursera class's lectures straight through.
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
| var lectureLinks = $('#page-content .item_list a.lecture-link') | |
| var timecodes = $.map(lectureLinks, function(link){ | |
| return link.text.split(" ").reverse()[0].replace(/[()]/g,'') | |
| }) | |
| var times = $.map(timecodes, function(time){ | |
| var timesplit = time.split(':') | |
| var min = timesplit[0], sec = timesplit[1] | |
| return min*60+sec*1 | |
| }) | |
| var total = 0; for (var time in times) { total += times[time] } | |
| 'Total Time: ' + Math.floor(total/(60*60)) + ":" + Math.floor(total / 60) % 60 + ":" + total % 60 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment