JSFiddle

  • Trie question

    Unsolved

    /*
     The story thus far... an engineer was just getting started implementing a trie.
     They got distracted and never finished. Implement ...
  • trie in js

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

    /*
     The story thus far... an engineer was just getting started implementing a trie. They got distracted and never finished. Implement ...
  • isURL regex #3 is the latest revision

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

    
    function prependHTTP(stringURL) {
        if (stringURL.indexOf('http://') !== 0 && stringURL.indexOf('https://') !== 0) {
            stringURL = `http://${stringURL}`;
        }
        return stringURL;
    }
    
    function isSimpleUrl(urlString) {
        return urlString.match(/[-a-zA-Z0-9@:%_\+.~#?&//=]{2,256}\.[a-z]{2,63}\b(\/[-a-zA-Z0-9@:%_\+.~#?&//=]*)?/gi) !== null;
    }
    
    function tester ...
  • query string parsing

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

    // some version of underscore found in src/j/libraries/backbone/underscore.js
    (function(){var n=this,t=n._,r ...
  • urijs tries to URI encode HTML entities

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

    const okurl = 'http://asdf.com/';
    const urlWithAmp = 'http://asdf.com/?asdf=asdf&qwerty=qwerty';
    
    let uriObj = new URI(okurl)
    console ...
  • Video editor scrubber #4 is the latest revision

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

    <svg style="display:none;">
      <defs>
        <g id="handle" viewBox="0 0 9 9">
          <polygon points="5.03 1.84 5.03 0 3.97 0 3.97 1.84 0 4.92 0 9 9 9 9 4.92 5.03 1.84"/>
        </g>
      </defs>
    </svg>
    
    <div class="video_trimmer">
      <div class="trimmed"></div>
      <div class="handle left">
        <svg><use x="0" y="0" href="#handle" /></svg>
      </div>
      <div class="handle right">
        <svg><use x="0" y="0" href="#handle" /></svg>
      </div>
    </div>
    
    
    
    
  • overlapping gradients

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

    <div class="gr gr1">
      <div class="gr gr2">
        <div class="gr gr3">
          <div class="gr gr4">
    
          </div>
        </div>
      </div>
    </div>
  • array unique

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

    var unique1 = function(arr) {
      var result = [];
      for (var i = 0, length = arr.length; i < length; i++) {
        if (result.indexOf(arr ...
  • intersection #1 is the latest revision

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

    // Find the intersection of 2 sorted arrays
    var A = [1,2,3,4];
    var B = [3,4,5,6,7 ...
  • islands #4 is the latest revision

    Find clusters (islands) in a 2 dimensional array using a little recursion.

    function countIslands (gameboard) {
      var islandCount = 0;
      var colLength = gameboard[0].length;
      var rowLength = gameboard.length;
      function sinkNeighbors(row, col) { //r ...