JSFiddle

  • Natalie's Hug Timer #20 is the latest revision

    The number of hugs Brad owes Natalie on any given day.

    jQuery(document).ready(function ($) {
    
        /**
         * Given timestamp in ms, determine # of days since 2013-08-04.
         */
        function dayIndex(milliStamp) {
            return Math.ceil((milliStamp ...
  • Project Euler Problem 3 #7 is the latest revision

    http://projecteuler.net/problem=3 This solution is terrible, but gets the right answer.

    function isPrime(test){
      var retval = false;
      for(var i = 2;i < Math.round(test/2);i++){
        if(test % i == 0 ...
  • Project Euler Problem 1 #9 is the latest revision

    http://projecteuler.net/problem=1

    var upper = 1000, sum = 0;
    while(upper--){
        sum += (!(upper % 3) || !(upper % 5)) ? upper : 0;
        }
    document.getElementById("result").innerHTML = sum;
    
  • Gob's Program #5 is the latest revision

    jQuery 1.7.2, HTML, CSS, JavaScript

    jQuery(document).ready(function($){
      var $output = $("#terminal"),
      i = 0;
      function penus() {
        $output.append("PENUS &nbsp;&nbsp;");
        if (i >= 1500) {
          clearInterval(interval);
        }
        i ...
  • BBCC Even Numbers

    http://www.reddit.com/r/badcode/comments/uxdcf/bbcc_get_all_the_even_numbers_between_two_numbers/

    var j = parseInt(prompt("Number",100));
        j = (j % 2 == 0) ? j : (j-1); // Get first even number in sequence
    var output ...
  • Monty Hall #7 is the latest revision

    A small empirical solution to the Monty Hall problem in JavaScript.

    function randInt(min,max){
      return Math.floor(Math.random() * (max - min + 1)) + min;
      }
    
    var play = {games: 100000,noSwitch: 0, withSwitch ...
  • Tiny ISBN Validator #70 is the latest revision

    A JavaScript String method for validating ISBNs. Returns the ISBN if valid, false if otherwise.

    /* Takes a string or array. On success returns the valid ISBN, which evaluates true. On failure returns 0, which evaluates ...