JSFiddle

  • Promises promises #17 is the latest revision

    Just for fun, my own promises implementation.

    function Promise(init) {
        this.pending = true;
        this.fulfilled = false;
        this.rejected = false;
        this.value = null;
        this.reason = null;
        
        function fulfil ...
  • css naming conventions

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

    <div class="broken-module">
         <h1 class="header">broken module</h1>
        <p>
            This is broken because the header is italicised even though
            we do not declare it to be so ...</p></div>
  • File experiment

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

    (function (window, undefined) {
    
        var fileInput = document.querySelector("#file-selector");
    
        function fileInputChange(event) {
    
            var files = event.target.files;
    
            for (var i = 0 ...
  • Revealing module pattern

    Underscore 1.4.4, HTML, CSS, JavaScript

    function NSI(name, obj) {
        window[name] = obj;
    }
    NSI("processText", function (text) {
        console.log("processing text: %s, thanks", text);
    });
    NSI("doAlert ...
  • calculate factors of a number #15 is the latest revision

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

    function getFactors(subject) {
        
        var factors = [];
        for(var i=1; i < subject;i++) {
        
            if(subject % i == 0) {
            
                factors.push(i);
            }
        }
        return ...
  • KnockoutVisitor #3 is the latest revision

    Knockout.js 3.0.0, HTML, CSS, JavaScript

    function createModel() {
        var self = {};
        
        self.foo = function () {
            console.log("this is foo");
        }
    
    }
  • visitor #1 is the latest revision

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

    <div class="block alpha"></div>
    
    <div class="block beta"></div>
    
    <div class="block gamma"></div>
  • accordion #12 is the latest revision

    jQuery Compat (edge), HTML, SCSS, JavaScript

    //  main and nested container elements
    var $main = $('.big-container');
    var $nested = $('.inner-container');
    //  this has to be done at initialisation
    var mainHeight ...
  • nuclear sign #4 is the latest revision

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

    <div class="nuclear-sign">
  • cpu adder

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

    function halfAdder(inputA, inputB) {
    
        var a = OR(inputA, inputB);
        var b = NAND(inputA, inputB)
    
        return AND(a, b);
    }
    
    function adder ...