Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save FredrikAugust/77c633503159065bad85 to your computer and use it in GitHub Desktop.
Save FredrikAugust/77c633503159065bad85 to your computer and use it in GitHub Desktop.
cheat for the number memory test on human benchmarking
// Human Benchmarking - Number Memory Test cheat
// Written by Fredrik A. Madsen-Malmo
//
// For educational purposes only. Duh
// Error when trying to access jQuery outside top-level scope
var j = $;
var current_number;
// Assign in if for more DRY-ness
var _number;
var _input;
function cheat () {
if ((_number = j('.big-number'))) {
current_number = j('.big-number').innerHTML;
console.log(current_number);
} else if ((_input = j('input[ng-model="userAnswer"]'))) {
j('.call-to-action').innerHTML = 'What\'s the number you ask? ' + current_number + '.';
}
}
setInterval(cheat, 300);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment