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
Idea: use web rtc/ web audio to record a short audio clip, do pitch changing on it | |
Links | |
- http://recordrtc.org/ | |
- https://github.com/danielstorey/WebAudioTrack | |
- https://www.webrtc-experiment.com/msr/audio-recorder.html |
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
/** | |
* @author yomboprime https://github.com/yomboprime | |
* | |
* GPUComputationRenderer, based on SimulationRenderer by zz85 | |
* | |
* The GPUComputationRenderer uses the concept of variables. These variables are RGBA float textures that hold 4 floats | |
* for each compute element (texel) | |
* | |
* Each variable has a fragment shader that defines the computation made to obtain the variable in question. | |
* You can use as many variables you need, and make dependencies so you can use textures of other variables in the shader |
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
/* | |
* @author zz85 / https://github.com/zz85 | |
* @author mrdoob / http://mrdoob.com | |
* Running this will allow you to drag three.js objects around the screen. | |
*/ | |
THREE.DragControls = function ( _objects, _camera, _domElement ) { | |
if ( _objects instanceof THREE.Camera ) { |
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
// This is @zz85's attempt to understand and annotate the greenlet.js lib | |
// from https://github.com/developit/greenlet/blob/master/greenlet.js | |
/** Move an async function into its own thread. | |
* @param {Function} fn The (async) function to run in a Worker. | |
*/ | |
export default function greenlet(fn) { // greenlet takes in a function as argument | |
let w = new Worker( // creates a web worker | |
URL.createObjectURL( // that has a local url | |
new Blob([ // created from a blob that has the following content |
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
<html> | |
<body> | |
<script> | |
class File { | |
constructor(name, size) { | |
this.name = name; | |
this.size = size; | |
} | |
} |
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 draw(path, current) { | |
const navs = [ | |
elm('h5', { class: 'nav-group-title' }, `${path.join('/')} ${format(current.value)}`, { | |
onclick: () => State.navigateTo(path.slice(0, -1)) | |
}) | |
] | |
// let str = '----------\n' | |
const nodes = current._children || current.children || [] |
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
class Counter { | |
constructor() { | |
this.map = new Map(); | |
} | |
add(key) { | |
this.map.set(key, this.map.has(key) ? this.map.get(key) + 1 : 1); | |
} | |
print() { |
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
// Also see https://github.com/tj/node-blocked/blob/master/index.js and https://stackoverflow.com/questions/28563354/how-to-detect-and-measure-event-loop-blocking-in-node-js | |
const blocked = require('blocked'); | |
blocked(function(ms) { | |
console.log("Blocked", ms); | |
}, { threshold: 10 }); | |
var blockDelta = 1; | |
var interval = 500; |
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
const { EventEmitter } = require('events'); | |
// const jumphash = require('jumphash'); | |
const _jumphash = require('@ceejbot/jumphash'), | |
crypto = require('crypto'); | |
function jumphash(key, buckets, algo='md5') { | |
const buffer = crypto | |
.createHash(algo) | |
.update(key) |
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
class GenericCache { | |
constructor() { | |
this.cache = new Map(); | |
} | |
set(key, promise, options) { | |
if (typeof promise === 'function') { | |
promise = promise(); | |
} |