This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Test for the Web Audio API <http://chromium.googlecode.com/svn/trunk/samples/audio/specification/specification.html> | |
Modernizr.addTest('webAudioApi', function () { | |
return !!(window.webkitAudioContext || window.AudioContext); | |
}); | |
// Test for the Audio Data API <https://wiki.mozilla.org/Audio_Data_API> | |
Modernizr.addTest('audioDataApi', function () { | |
return !!new Audio().mozSetup; | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://ccrma.stanford.edu/courses/422/projects/WaveFormat/ | |
function buildWaveHeader(opts) { | |
var numFrames = opts.numFrames; | |
var numChannels = opts.numChannels || 2; | |
var sampleRate = opts.sampleRate || 44100; | |
var bytesPerSample = opts.bytesPerSample || 2; | |
var blockAlign = numChannels * bytesPerSample; | |
var byteRate = sampleRate * blockAlign; | |
var dataSize = numFrames * blockAlign; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function () { | |
var typedArrays = [Int8Array, Uint8Array, Int16Array, Uint16Array, Int32Array, Uint32Array, Float32Array]; | |
if (window.Float64Array) { | |
typedArrays.push(Float64Array); | |
} | |
// fix for webkit pre slice rename | |
// https://bugs.webkit.org/show_bug.cgi?id=53618 | |
if (!Float32Array.prototype.subarray) { | |
typedArrays.forEach(function (cls) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (!FileReader.prototype.readAsArrayBuffer) { | |
FileReader.prototype.readAsArrayBuffer = function readAsArrayBuffer () { | |
this.readAsBinaryString.apply(this, arguments); | |
this.__defineGetter__('resultString', this.__lookupGetter__('result')); | |
this.__defineGetter__('result', function () { | |
var string = this.resultString; | |
var result = new Uint8Array(string.length); | |
for (var i = 0; i < string.length; i++) { | |
result[i] = string.charCodeAt(i); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// http://www.ietf.org/rfc/rfc2781.txt | |
function decodeUtf16(w) { | |
var i = 0; | |
var len = w.length; | |
var w1, w2; | |
var charCodes = []; | |
while (i < len) { | |
var w1 = w[i++]; | |
if ((w1 & 0xF800) !== 0xD800) { // w1 < 0xD800 || w1 > 0xDFFF | |
charCodes.push(w1); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val job = new Job(getConf()) | |
job.getConfiguration().setInt("mapred.map.tasks", 1) | |
job.setJarByClass(classOf[LogStats]) | |
job.setJobName("logstats") | |
job.setMapperClass(classOf[LocMap]) | |
job.setReducerClass(classOf[CountReduce]) | |
job.setMapOutputKeyClass(classOf[TextTriple]) | |
job.setMapOutputValueClass(classOf[LongWritable]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object ❄ | |
object ❅ { | |
def apply(o:Any) = println(o) | |
} | |
object ☃ { | |
def ❄(s:Any) = '❄' | |
def ❅❅(s:Any) = "❅❅" | |
def ☃(x:Any) = {this} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// TileMill provider for Unfolding (or modestmaps-processing?) | |
// requires Unfolding (http://unfoldingmaps.org/) and GLGraphics (http://glgraphics.sourceforge.net/) | |
// this is important. weird. | |
import processing.opengl.*; | |
import codeanticode.glgraphics.*; | |
import de.fhpotsdam.unfolding.core.*; | |
import de.fhpotsdam.unfolding.geo.*; | |
import de.fhpotsdam.unfolding.utils.*; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// scala -cp /Users/ryan/Downloads/commons-jxpath-1.3/commons-jxpath-1.3.jar:/Users/ryan/Downloads/miglayout-4.0.jar:/Users/ryan/Downloads/geotools-8.0-M4/\*:/Users/ryan/Downloads/jscience-4.3/jscience.jar:/Users/ryan/work/vendor/jts-1.12/lib/jts-1.12.jar show_shapefile.scala ~/Downloads/tl_2009_us_county/tl_2009_us_county.shp | |
import scala.collection.JavaConversions._ | |
import java.awt.image.BufferedImage | |
import java.awt.Color | |
import java.awt.Rectangle | |
import java.awt.RenderingHints | |
import java.io.File | |
import java.util.HashMap |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var host = "localhost:9999" | |
var page = 1 | |
var ws = new WebSocket("ws://" + host + "/devtools/page/" + page) | |
ws.onmessage = function(m) {console.log(m.data)} | |
var counter = 0 | |
var send = function (method, params) { | |
ws.send(JSON.stringify({id: counter++, 'method': method, 'params': params})) | |
} |