JSFiddle

  • Async JS Tutorial

    Shows how async requests work, and how sync requests can wreck the UI

    var count = 0;
    var makeRequest = function() {
      $('#output').prepend('request sent');
      var deferred = $.ajax({
        url: '/echo/json/',
        method: 'post',
        
        // CHANGE TO ...
  • Simple anonymizer

    Replaces lowercase alpha, uppercase alpha, and digits with randomized counterparts and leaves everything else alone to preserve a semblance of lexical structure.

    var letters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ".split('');
    
    // min AND MAX inclusive.
    function rInt(min, max) {
      return Math.floor(Math.random() * (max - min + 1 ...
  • form add row with drop down

    jQuery 1.7.2, HTML, CSS, JavaScript

    var $pushMe = $('#pushMe');
    var $target = $('#target');
    var $template = $('#template');
    var $total = $('#total');
    var index = 0;
    
    var options = ["one","two","three ...
  • underscore examples

    jQuery 1.7.2, HTML, CSS, JavaScript

    //Pearson Correlation Function:
    function getPearsonCorrelation(x, y) {
        var shortestArrayLength = 0;
         
        if(x.length == y.length) {
            shortestArrayLength = x.length;
        } else if ...
  • BA-micropub tests

    examples / sandbox for Ben Alman's JQuery micro pub-sub framework. https://gist.github.com/cowboy/661855

    // the tiny pub/sub
    (function($) {
      var o = $({});
      $.subscribe = function() {
        o.on.apply(o, arguments);
      };
      $.unsubscribe = function() {
        o.off.apply(o ...
  • feedback injectable

    jQuery 1.7.2, HTML, CSS, JavaScript

    window.injectFeedbackForm = function (target) {
    
        var $appended = $('<div class="inline-feedback-form-container"><div class="inline-feedback-form"><textarea class="feedback"></textarea><button class="feedback-submit">submit</button></div></div>');
        
        $(target).append($appended);
    
        $appended.find('.feedback-submit').click(function () {
            jQuery.ajax(
                '/echo/json/', {
                data ...
  • CSS :after example

    No-Library (pure JS), HTML, CSS, JavaScript

    <div id="outer">
        outer
        <div id="inner">
           inner
        </div>
        outer again
    </div>
    
  • JQ checkbox bench

    workspace for working out the best wqays to interact with checkboxes.

    $('#yesno').change(function(){
        $('#output').html($('#yesno').is(':checked') ? "yes" : "no" );
     });
    
    $('#proxy').click(function(){
        $('#yesno').removeAttr('checked');
        $('#yesno').trigger('change');
    });
  • multifrustration

    A little multiplication practice and memory app

    window.mxf = {};
    
    window.mxf.multiplicationQuestionBuilder = (function () {
        var qb = {};
        qb.next = function () {
            var a = Math.floor((Math.random() * 10) + 1);
            var ...
  • Css Transition Bits

    jQuery 1.8.3, HTML, SCSS, JavaScript

    $(function(){
        $('.info').click(function(){
            $(this).toggleClass('show-more');
        });
    });