JSFiddle

  • Trivial dynamic table

    Builds some JSON from a 2 x 2 dynamic HTML table

    function deleteRow() {
      $(this).parent().remove();
      show();
    }
    
    function addRow() {
      let newRow = $(`
        <div>
          <input class="key">
          <input class="value">
          <button class='delete'>delete</button>
        </div>`);
      $(this).prev().append(newRow);
      newRow.find('input').on('input ...
  • Email Fields vs. Text Fields

    Interactive exploration on the differences between input type=email and input type=text

    function $(selector) {return document.querySelector(selector);}
    const email = $('#email');
    const emailEcho = $('#emailEcho');
    const text = $('#text');
    const textEcho = $('#textEcho');
    $('#email').oninput ...
  • Mandelbrot Set #1 is the latest revision

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

    eval(unescape(escape`๐ฉฏ๐จฑต๐ซ‘ฅ๐ซกด๐›กท๐ฌกฉ๐ญฅ๐จ€ผ๐จฑก๐ซกถ๐จ‘ณ๐˜ฉ๐ฉ€ฝ๐  ๐ชฅ๐ช‘ง๐ชด๐Ÿฒ๐ฐ๐Ÿก ๐žฑฆ๐ซฑฒ๐š‘๐Ÿถ๐ฉด๐žฑ‘๐›ญ๐žฑ๐›กง๐ฉ‘ด๐ ฑฏ๐ซกด๐ฉ‘ธ๐ญ ๐œกค๐จ€ฎ๐ฉกฉ๐ซฌ๐คกฅ๐จฑด๐š‘๐™ณ๐œ€ฐ๐›‘๐›ฐณ๐œ€ฐ๐›€ฑ๐›‰๐›ฐน๐œ€ฉ๐š‘ฆ๐ซฑฒ๐š–๐Ÿ‘˜๐Ÿ‘‘๐›ฐฑ๐œ€ฐ๐™ณ๐›ฒ๐›—๐Ÿ‘™๐Ÿ‘‘๐›ฐณ๐ฉด๐›ฑ๐›‰๐Ÿน๐œ€ป๐ขญ๐›ฆ๐™ก—๐šก—๐Ÿ€น๐žฑ—๐Ÿ‘š๐šฑš๐šฑ™๐š‘š๐Ÿ‘–๐šก—๐›–๐Ÿ‘–๐šก–๐›‘—๐šก—๐šฑ˜`.replace(/u../g,'')))
    
  • Demo to answer a question on the forums

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

    g = ohm.grammarFromScriptElement()
    
    semantics = g.createSemantics().addOperation('view', {
      greeting(x) {
        document.getElementById('result').innerHTML = JSON.stringify(x.view());
      },
      _terminal() {return ...
  • RGB SVG

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

    <svg width="200" height="200">
      <path d="M 100 100 L 13.3974596216 150
               A 100 100 1 0 1 100 0 Z" fill="rgb(251,76,77)"/>
      <path d="M 100 100 L 100 0 
               A 100 100 1 0 1 186.6025403784 150 Z" fill="rgb(100,202,46)"/>
      <path d="M 100 100 L 186.6025403784 150
               A 100 100 1 0 1 13.3974596216 150 Z" fill="rgb(38,103, 240)"/>
    </svg>
    
    
  • Shape classes

    Some JavaScript shape classes, with unit tests, of course

    /*
     * A circle datatype.
     *
     * Synopsis:
     * let c = new Circle(10);
     * c.radius ==> 10
     * c.area() ==> 314.1592653589793
     * c.perimeter() ==> 62.83185307179586 ...
  • A simple, non-encapsulated Queue type #6 is the latest revision

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

    /*
     * A simple queue data type. Queues are entirely mutable. The
     * add and remove methods are simple conveniences, but clients
     * are ...
  • Ohm Polynomial Differentiator

    Illustration of using Ohm to parse polynomials and generating derivatives with semantic actions written in CoffeeScript

    g = ohm.grammarFromScriptElement()
    
    semantics = g.createSemantics().addOperation('diff', {
      Poly_plus: (p, op, t) -> p.diff() + "+" + t.diff(),
      Poly_minus: (p, op, t ...
  • Point in Triangle #16 is the latest revision

    Includes a point in triangle test, taken from urruka's fiddle at http://jsfiddle.net/PerroAZUL/zdaY8/1/

    "use strict";
    
    class Triangle {
      constructor(maxWidth, maxHeight) {
        this.randomize(maxWidth, maxHeight);
      }
      randomize(maxWidth, maxHeight) {
        ['a', 'b', 'c'].forEach(vertex => {
          this ...
  • Exam Answers, with Tests!

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

    "use strict";
    
    // These are my final exam solutions for LMU CMSI 185-02
    // The exam was held on 2015-12-17.
    
    // 1
    
    function ...