This file contains hidden or 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 mozLoadFile (url, callback) { | |
function throwAsync (err) { | |
setTimeout(function () { | |
callback(typeof err === 'string' ? | |
Error(err) : err); | |
}, 0); | |
} | |
function onaudioavailable (e) { | |
loadedmetadata(); |
This file contains hidden or 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
/* First, we need a Sink */ | |
var dev = Sink(); | |
/* So, here we'll create an oscillator and an LFO to control the oscillator FM. */ | |
var osc = audioLib.Oscillator(dev.sampleRate, 440); | |
var lfo = audioLib.Oscillator(dev.sampleRate, 0.1); | |
/* | |
Then we'll put a delay effect after the oscillator. | |
Note that we have to use createBufferBased() to make a multi-channel effect. |
This file contains hidden or 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
NOOP := rm -f | |
me: | |
@$(NOOP) | |
a: | |
@$(NOOP) | |
sandwich: | |
@if [ `whoami` = "root" ]; then echo "one sandwich coming right up!"; else echo "hah, make me!"; fi |
This file contains hidden or 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
#include <stdlib.h> | |
#include <stdio.h> | |
int main () { | |
char *c = (char *)malloc(sizeof(char) * 16); | |
char *cc = c; | |
for (int i=0; i<16; i++) { | |
printf("%d\n", cc[0]); |
This file contains hidden or 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
#0 0x000000000056b1ad in v8::HandleScope::HandleScope() () | |
#1 0x00007ffff59da056 in CubebStream::DataCB (stream=0xc806f0, user=0xc80480, buffer=0x7fffef4cc040, nframes=11113) at ../src/stream.cpp:165 | |
#2 0x00007ffff57cf82e in stream_request_callback (s=0xc80740, nbytes=22226, u=0xc806f0) at src/cubeb_pulse.c:107 | |
#3 0x00007ffff55b1b4c in ?? () from /usr/lib/libpulse.so.0 | |
#4 0x00007ffff514c303 in ?? () from /usr/lib/libpulsecommon-1.1.so | |
#5 0x00007ffff514c673 in pa_pdispatch_run () from /usr/lib/libpulsecommon-1.1.so | |
#6 0x00007ffff55951ed in ?? () from /usr/lib/libpulse.so.0 | |
#7 0x00007ffff5150f19 in ?? () from /usr/lib/libpulsecommon-1.1.so | |
#8 0x00007ffff55a7c8e in pa_mainloop_dispatch () from /usr/lib/libpulse.so.0 | |
#9 0x00007ffff55a8055 in pa_mainloop_iterate () from /usr/lib/libpulse.so.0 |
This file contains hidden or 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
#include <stdlib.h> | |
#include <unistd.h> | |
#include <stdio.h> | |
#define detach if (fork()); else for (;; exit(0)) | |
int calculate () { | |
detach { | |
sleep(1); | |
return 5; |
This file contains hidden or 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
// Example usage, a MIDI proxy that picks the first available MIDI input and routes its messages to the first MIDI outputs | |
navigator.getUserMedia({midi: true}, function (MIDIAccess) { | |
try { | |
var input = MIDIAccess.getInput(MIDIAccess.enumerateInputs()[0]); | |
var output = MIDIAccess.getOutput(MIDIAccess.enumerateInputs()[0]); | |
} catch (e) { | |
console.error("Couldn't find suitable MIDI devices"); | |
} |
This file contains hidden or 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
/* JS SHELL */ | |
if (typeof load !== 'undefined') { | |
load('./vector.js'); | |
/* NODEJS */ | |
} else if (typeof require !== 'undefined') { | |
Vector = require('./vector.js'); | |
print = function () { | |
return console.log.apply(console, arguments); | |
}; | |
/* BROWSER */ |
This file contains hidden or 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 (define, names) { | |
if (!define || !names.forEach) return; | |
names.forEach(function (name) { | |
define(Number.prototype, name, { | |
value: function () { | |
return Math[name].apply( | |
Math, | |
[this].concat([].slice.call(arguments)) |
This file contains hidden or 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 (global, prefixes, timeouts, id, i) { | |
if (typeof process !== 'undefined' && process && process.nextTick) { | |
global.setImmediate = function (callback, args) { | |
var i = id; | |
timeouts[id] = { | |
c: callback, | |
a: args || [], | |
}; |