Skip to content

Instantly share code, notes, and snippets.

@vladson
Created July 23, 2014 13:35
Show Gist options
  • Save vladson/14c4aedd650da72a706b to your computer and use it in GitHub Desktop.
Save vladson/14c4aedd650da72a706b to your computer and use it in GitHub Desktop.
Coursera quiz computer
grades = _.map($('.course-quiz-item-score > td >span'),
function(i){
return _.map($(i).clone().children().remove().end().text().split(' / '),
function(j){return Number.parseFloat(j)});});
pos = _.reduce(grades, function(memo, i){ return memo + i[1]}, 0)
got = _.reduce(grades, function(memo, i){ return memo + i[0]}, 0)
result = got / pos
alert('You got ' + result*100 + '% till now')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment