Skip to content

Instantly share code, notes, and snippets.

@ddugovic
Created March 17, 2019 01:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ddugovic/64b7638338fa7d366b22e113ed9669b3 to your computer and use it in GitHub Desktop.
Save ddugovic/64b7638338fa7d366b22e113ed9669b3 to your computer and use it in GitHub Desktop.
untested.js
function play(min,sec){var challenges=$(".challenge");if(arguments.length===0)return challenges.eq(Math.floor(Math.random()*challenges.length)).find(".accept").click();else{challenges=challenges.filter(function(){return $(this).find(".desc").text().search(new RegExp(min+"\\+"+sec))!==-1});if(challenges.length===0)console.log("No challenges matching the specified time control");else{return challenges.eq(Math.floor(Math.random()*challenges.length)).find(".accept").click()}}}
@ddugovic
Copy link
Author

Thanks to an anonymous viewer of IM Eric Rosen's twitch channel. (Sorry I didn't record the author's name.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment