Discover gists
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
<!-- make a synchronous cross-domain request to The Echo Nest API --> | |
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Echo Nest API Cross-Domain Example</title> | |
</head> | |
<body> | |
<h1>Echo Nest API Cross-Domain Example</h1> | |
<p><strong>Results:</strong></p> |
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 Nest(api_key) { | |
this.api_key = api_key; | |
} | |
Nest.prototype = { | |
analyzeFile: function(file, type, options) { | |
var form = new FormData(); | |
form.append('api_key', this.api_key); | |
form.append('track', file); | |
form.append('filetype', type); |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Analyze</title> | |
<script src="nest.js" type="text/javascript"></script> | |
</head> | |
<body> | |
<h1>Analyze</h1> |
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
(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
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})) | |
} |
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
Import["http://lead.ryanberdeen.com/render?target=randomWalkFunction(%\ | |
27hello%2C+world%27)", "JSON"] |
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 eslint = require('eslint'); | |
var CLIEngine = eslint.CLIEngine; | |
var linter = eslint.linter; | |
var baseConfig = {format: 'stylish'}; | |
console.log(baseConfig.format); | |
new CLIEngine({baseConfig: baseConfig}).getConfigForFile('.'); | |
console.log(baseConfig.format); |
NewerOlder