Skip to content

Instantly share code, notes, and snippets.

View zz85's full-sized avatar

Joshua Koo zz85

View GitHub Profile
@zz85
zz85 / Brain Dump
Last active August 29, 2015 14:20
Canvas Markup Langague
v: [
'#time-slider',
'#time-grid'
];
<vpanel>
<timeslider />
<timegrid />
</vpanel>
@zz85
zz85 / asm-o1-optimizations.js
Last active August 29, 2015 14:23
Strange Segmentation Fault in glsl-optimizer + emscripten opitimizations
function __ZL25remove_unlinked_functionsPKvPvS1_($key, $data, $closure) {
$key = $key | 0;
$data = $data | 0;
$closure = $closure | 0;
var $0 = 0, $1 = 0, $10 = 0, $11 = 0, $12 = 0, $13 = 0, $14 = 0, $15 = 0, $16 = 0, $17 = 0, $18 = 0, $19 = 0, $2 = 0, $3 = 0, $4 = 0, $5 = 0, $6 = 0, $7 = 0, $8 = 0, $9 = 0;
var label = 0, sp = 0;
sp = STACKTOP;
$0 = $data + 16 | 0;
$1 = __ZNK9exec_list8is_emptyEv($0) | 0;
if (!$1) {
@zz85
zz85 / request_cache.js
Last active September 23, 2015 05:28
Request + LRU Cache
var request = require('request');
var LRU = require('lru-cache');
/*
Request + LRU Cache
- request_cache(target, callback() {})
*/
@zz85
zz85 / ExtrudeGeometry.js
Created July 26, 2011 08:11
Bevel Problems
/**
* @author zz85 / http://www.lab4games.net/zz85/blog
* Creates extruded geometry from a path shape.
**/
THREE.ExtrudeGeometry = function( shapes, options ) {
THREE.Geometry.call( this );
shapes = shapes instanceof Array ? shapes : [ shapes ];
@zz85
zz85 / perlin-noise-classical.js
Created September 13, 2011 15:37 — forked from banksean/perlin-noise-classical.js
two Perlin noise generators in javascript. The simplex version is about 10% faster (in Chrome at least, haven't tried other browsers)
// Ported from Stefan Gustavson's java implementation
// http://staffwww.itn.liu.se/~stegu/simplexnoise/simplexnoise.pdf
// Read Stefan's excellent paper for details on how this code works.
//
// Sean McCullough banksean@gmail.com
/**
* You can pass in a random number generator object if you like.
* It is assumed to have a random() method.
*/
@zz85
zz85 / werckmeister.js
Created November 29, 2011 20:19
midi number to frequency using Werckmeister I (III) temperament
// by https://github.com/zz85
// http://en.wikipedia.org/wiki/Werckmeister_temperament
// Werckmeister I (III): "correct temperament" based on 1/4 comma divisions
var werckmeister = [
1, // c
256/243, // c#
64 / 81 * Math.pow(2, 1/2), // d
32/27, // d#
@zz85
zz85 / OrbitControls.js
Created December 1, 2011 21:00
At times, don't you just need a simple camera which rotates around an object in Theee.js?
/*
* @author @blurspline https://github.com/zz85
* Similar to a turntable or a hovering camera?
*/
THREE.OrbitControls = function( camera, target, distance, height, time ) {
var rotationUnits = time * 1000;
var startTime;
this.start = function() {
@zz85
zz85 / LICENSE.txt
Created December 2, 2011 10:25 — forked from mirceapricop/LICENSE.txt
140byt.es -- Click ↑↑ fork ↑↑ to play!
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@zz85
zz85 / gist:1933802
Created February 28, 2012 17:21
Annotated Code Segment for Snow Scene
// Produces 50 snow particles every second
particleProducer = new SPARKS.SteadyCounter( 50 );
// Create the sparks.js Emitter
sparksEmitter = new SPARKS.Emitter( particleProducer );
// This defines that snow should emit from an plane like area
// instead of a point, giving the feel of snow falling from the sky
var zone = new SPARKS.ParallelogramZone(
new THREE.Vector3(-1400,800,-1000),
@zz85
zz85 / dabblet.css
Created March 2, 2012 12:47
Playing with the slider
body {
background-color: #333;
}
#rslider {
position:absolute;
left:50%;
width:100px;
height:18px;
border-radius:0 6px 6px 0;