View on GitHub

dcollien

David Collien's GitHub Repositories

JavaScript CoffeeScript Python C Haskell Java

FilterHTML JavaScript Python

A white-listing HTML Filter with an easy-to-define white list. Both Python and JavaScript versions. Supports style and class parsing, unicode removal, script tag removal, filtering by HTML colors, measurements, url matching, RegExp matching, with tag conversion, text node filtering, and more.

Allowed HTML Specification
HTML
Dreamcoat CoffeeScript

Automatically determine a color scheme based off a logo image. Demonstrates color octree quantization and KMeans clustering in literate coffeescript. Added tools for background color, and contrasting text color guessing.

Badge Maker JavaScript

Build snazzy badges on an HTML5 Canvas. Defining your own badge shapes and parameters is pretty easy as well.

Expression Parser JavaScript

Parse simple expressions, in a language of your own description. Evaluates expressions, or lists of expression tokens. Converts expressions into Reverse Polish Notation and back. Lets you use your own tokeniser or the simple built-in one.


Language Definition:
{
  // Parsing
  INFIX_OPS: {
    '+': function(a, b) {
      return a + b;
    },
    '-': function(a, b) {
      return a - b;
    },
    '*': function(a, b) {
      return a * b;
    },
    '/': function(a, b) {
      return a / b;
    }
  },
  PREFIX_OPS: {
    'SQRT': function(expr) {
      return Math.sqrt(expr);
    }
  },
  PRECEDENCE: [['SQRT'], ['*', '/'], ['+', '-']],
  GROUP_OPEN: '(',
  GROUP_CLOSE: ')',

  // Tokenising
  SEPARATOR: ' ',
  SYMBOLS: ['(', ')', '+', '-', '*', '/'],

  // Evaluating Terminals
  termDelegate: function(term) {
    return parseInt(term);
  }
}
                
Teapot Server C

An HTTP server to run on HTTP-enabled teapots to help differentiate them from HTCPCP devices on the same network.

jQuery.makePlugin JavaScript

An easy way to make jQuery Plugins.

Turns this:

var MyClass = function($container, options) {
    this.$container = $container;
    this.options = options;
};

$.extend(MyClass.prototype, {
    changeLinkColor: function(color) {
        this.$container.find('a').css('color', color);
    }
});
  
Into this:

$('#someElementByID').myPlugin({someOption: 42});
$('#someElementByID').myPlugin('changeLinkColor', 'red');
  
(also allows for a custom jQuery interface to be specified)
Stegosaurus.js JavaScript

Inserts hidden messages into the least significant bits of pixel data, for source-tracking an image, even if it's just been screenshotted. Uses HTML5 canvas to render and manipulate the pixels. Also comes with some tools to mess with anyone who tries to save an image from the canvas.

SteaMOS Java

An emulator for a system quite similar to CMOS (digital logic), but designed to work with steam (or compressed air) instead of electrical components. For designing steampunk computing hardware.

EyeSocket Python

A project based on OpenCV (3.0) to detect and track multiple faces from multiple camera views in real-time, and make inferences about the actions that people are making in those images. The output data is streamed over a UDP socket so it can be used by other applications (e.g. a rendering system). This project was used for the VIVID art installation Monster World where it was connected to a Unity engine project.

Basic LTI Authentication Python

A Python library for generating bLTI (I.M.S. Basic Learning Tools Interoperability) launch links (as a Consumer), as well as providing a Django view decorator to authenticate bLTI requests (as a Provider).