Skip to content

Instantly share code, notes, and snippets.

@knowtheory
Created March 25, 2012 02:04
Show Gist options
  • Select an option

  • Save knowtheory/2190733 to your computer and use it in GitHub Desktop.

Select an option

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.
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