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
// 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
/* | |
* @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
/** | |
* @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
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
const express = require('express') | |
const app = express() | |
app.get('/', (req, res) => res.send('Hello World!')) | |
app.listen(4444, () => console.log('Example app listening on port 4444!')) | |
process.on('message', function(packet) { | |
console.log('process message received', packet, process.env.pm_id, process.env.NODE_APP_INSTANCE) |
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
message Dog { | |
} | |
message Cat { | |
} | |
message Elephant { |
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 Ib = require('ib'); | |
var ib = new Ib() | |
function getPositions(ib, cb) { | |
ib.on('position', onPositions) | |
ib.reqPositions() | |
var positions = []; | |
var pending = null; | |
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
/** | |
* seeing how @thespite gets drunk | |
* https://twitter.com/thespite/status/1056264007450062848 | |
*/ | |
e = t => t < .5 ? 2 * t * t : -1 + (4 - 2 * t ) * t, | |
n = _ => performance.now(), cT = n(), | |
nT = cT, | |
cV = 1, | |
nV = 1, |
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
use std::io; | |
use std::fs::{self, DirEntry}; | |
use std::path::Path; | |
use std::env; | |
/** | |
* compile: rustc du.rs | |
* run: compare | |
* /usr/bin/time -lp ./du ~/Documents | |
* /usr/bin/time -lp du -sk ~/Documents |