Skip to content

Instantly share code, notes, and snippets.

@ar5had
Created August 4, 2017 16:37
Show Gist options
  • Select an option

  • Save ar5had/aa522a6fe698228dd3dc0fbaa3c5843f to your computer and use it in GitHub Desktop.

Select an option

Save ar5had/aa522a6fe698228dd3dc0fbaa3c5843f to your computer and use it in GitHub Desktop.

Revisions

  1. ar5had created this gist Aug 4, 2017.
    13 changes: 13 additions & 0 deletions jsCheatsheet.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,13 @@
    // #1
    // Polyfill a few basic things.
    ['filter', 'forEach', 'map', 'reduce'].forEach(function (name) {
    Array[name] = function (array, callback, init) {
    return [][name].call(array, callback, init);
    };
    });

    // Automatically set up asynchronous JSON forms (all with a 'method' attribute).
    // Array.forEach(document.querySelectorAll('form'), function (form) { ....
    // url - https://github.com/jankeromnes/janitor/blob/ec1b1f7f0c955d18047be8460a75e46fbd33bf60/static/js/janitor.js

    // #2