Skip to content

Instantly share code, notes, and snippets.

View devongovett's full-sized avatar

Devon Govett devongovett

View GitHub Profile
/*
* Minimal classList shim for IE 9
* By Devon Govett
* MIT LICENSE
*/
if (!("classList" in document.documentElement) && Object.defineProperty && typeof HTMLElement !== 'undefined') {
Object.defineProperty(HTMLElement.prototype, 'classList', {
get: function() {
require 'tweakSiri'
require 'siriObjectGenerator'
#######
# This is a "hello world" style plugin. It simply intercepts the phrase "text siri proxy" and responds
# with a message about the proxy being up and running. This is good base code for other plugins.
#
# Remember to add other plugins to the "start.rb" file if you create them!
######
@devongovett
devongovett / gist:1468024
Created December 12, 2011 16:05
Aurora.js Ideas

Ideas for Aurora.js

Aurora.js is a JavaScript/CoffeeScript media framework that makes implementing audio formats, both containers and codecs much easier. Here are a few things it has:

  1. Sources (HTTP, streaming, File API, etc.)
  2. Shared Code (buffers, queues, bitstreams, etc.)
  3. Containers (demuxers)
  4. Codecs (decoders)
  5. Sink.js
/*
* Non-clamped setInterval
* By Devon Govett (idea from sink.js)
* MIT LICENSE
*/
(function() {
var BlobBuilder = this.BlobBuilder || this.MozBlobBuilder || this.WebKitBlobBuilder,
URL = this.URL || this.webkitURL,
/*
* Non-clamped setInterval
* By Devon Govett (idea from sink.js)
* MIT LICENSE
*/
(function() {
var BlobBuilder = this.BlobBuilder || this.MozBlobBuilder || this.WebKitBlobBuilder,
URL = this.URL || this.webkitURL,
/*
* Non-clamped setInterval
* By Devon Govett (idea from sink.js)
* MIT LICENSE
*/
(function() {
var BlobBuilder = this.BlobBuilder || this.MozBlobBuilder || this.WebKitBlobBuilder,
URL = this.URL || this.webkitURL,
class FileInfo
constructor: (filename) ->
@name = filename
mtime: ->
# in CoffeeScript, the last thing in a function is returned
# which in this case is the value returned from @withFile
# which is the value returned from the inner function
# => binds scope to the correct `this`
@withFile (f) =>
class Set
constructor: ->
@items = {}
@count = 0
guid = 0
stringCache = {}
hash = (object) ->
switch typeof object
when 'number', 'boolean'
function Bar() {
console.log("Bar");
}
Bar.prototype.baz = function() {
console.log("baz");
}
function Foo() {
console.log("hi");
@devongovett
devongovett / gist:2218587
Created March 27, 2012 18:11
get a blob from a canvas
function getBlob(canvas) {
var data = atob(canvas.toDataURL().replace('data:image/png;base64,', '')),
bytes = new Uint8Array(data.length);
for (var i = 0, len = data.length; i < len; i++) {
bytes[i] = data.charCodeAt(i) & 0xff;
}
var bb = new BlobBuilder();
bb.append(bytes.buffer);