News for hackers. Stuff that matters.
Re:Show HN: Speedsums by kornish on Monday June 29, 2015 @03:23AM (#9796809)

    (function() {
      var input = $('#answer'),
          question = $('#question'),
          solved = 0;

      var intvl = setInterval(function() {
        var questionText = question.text();
        questionText = questionText.replace('÷', '/').replace('x', '*').replace('=', '');
        input.val(eval(questionText));
        input.keyup();
        solved++

        if (solved == 119) clearTimeout(intvl);
      }, 50);
    })();

edit: seems to give an error if you solve >= 120 questions, so adjusted to stop at 119.
Re:Show HN: Speedsums by flaie on Monday June 29, 2015 @03:36AM (#9796840)
I could get to 118, but it doesn't want a 119th answer, or the UI gets completely broken.

http://imgur.com/HG0J9fN

Re:Show HN: Speedsums by kornish on Monday June 29, 2015 @03:38AM (#9796844)
Strange. The 119th answer is fine for me, but the 120th breaks it. I revised the script to not rely on interval multiplication, which can be flighty due to inconsistent latencies, but to rather keep a counter and cancel the interval after 119 solves.
Re:Show HN: Speedsums by flaie on Monday June 29, 2015 @03:52AM (#9796870)
This is the script I used, but yours blocks also on 119 for me.

    var answer = function() {
      var q = $("#question").text().replace(/x|÷|=/g, function(m) { return {'x':'*','÷':'/','=':''}[m]});
      $("#answer").val(eval(q)).keyup();
    };
    $('#question').bind("DOMSubtreeModified", function(){
      setTimeout(answer, 200);
    });
    answer();
Don't have much time to search why :-)