Skip to content

Instantly share code, notes, and snippets.

@74togo
Created August 24, 2013 02:05
Show Gist options
  • Save 74togo/6325605 to your computer and use it in GitHub Desktop.
Save 74togo/6325605 to your computer and use it in GitHub Desktop.
A cheat script for 10fastfingers
(function(){
/* Set up */
var input = jQuery("#inputfield");
var space_key = jQuery("#config_input_key").attr("value");
var chars_typed_so_far = 0;
/* Set this as desired */
var desired_WPM = 150;
function write_string(string) {
var e = jQuery.Event("keyup", {"which":space_key});
input.val(string);
input.trigger(e);
/* Plus one because of implied space */
chars_typed_so_far += string.length + 1;
}
/* 5 is the "average" word length the website uses */
function goal_met() {
return chars_typed_so_far / 5 >= desired_WPM;
}
/* Type as many correct words as needed */
for (var i = 0; i < words.length && goal_met() == false; i++) {
write_string(words[i]);
}
/* Throw in some wrong words to make it look legit */
for (i = 0; i < parseInt(Math.random()*3+3); i++) {
write_string("notaword");
}
/* Finish up the test early */
countdown = 0;
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment