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 / README.md
Last active February 6, 2016 14:40
Drawing / Painting as Many Rects as Possible (Still WIP, feel free to comments or contribute!)

Moved here

Fastest Rectangles

Some thoughts:

  • How many ways can you draw rectangles in a browser (eg. dom, css, 2d canvas, svg, webgl)
  • How is the fastest (most number of) rectangles can you draw with each approach?

Task:

  • Paint random rectangles for 5 seconds, find out how fast each approach takes.
@zz85
zz85 / test.jsx
Last active July 26, 2022 18:59
Prototype to make Scroll Position Sticky When Changing Dynamic Element Heights for React Infinite
function sum(total, next) {
return total + next;
}
var old = 0;
var NUM = 102;
var VariableInfiniteList = React.createClass({
componentDidMount: function() {
@zz85
zz85 / mesh_simplify.html
Last active November 7, 2023 02:10
Fast Quadric Mesh Simplification JS port
<!DOCTYPE html>
<html lang="en">
<head>
<title>three.js webgl - modifier - Fast Quadric Mesh Simplification</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
<style>
body {
font-family: Monospace;
background-color: #f0f0f0;
@zz85
zz85 / test.html
Last active June 21, 2016 01:51
Game API
<html>
<body>
<style>
body {
font-family: 'monospace';
font-size: 12px;
}
</style>
Hello Copter World!
<div id="debug"></div>
@zz85
zz85 / array_joining.js
Created June 23, 2016 05:34
Fastest Array Joins on Strings
var array = ['livechat', 'visitors', 'apple', 'display_name'];
function testConcat(y) {
return array.concat([y]);
}
function testDeconstruct(y) {
return [...array, y];
}
@zz85
zz85 / hello.js
Last active July 5, 2016 07:14
Adele Hello Chat Bot
// Inspired by http://www.dailymail.co.uk/femail/article-3672152/Man-infuriates-Facebook-scammer-Adele-lyrics.html && simon toh
// ADELE Hello lyrics
HelloMsgs = `
Hello, it's me, I was wondering
If after all these years you'd like to meet to go over everything
They say that time's supposed to heal, yeah
But I ain't done much healing
Hello, can you hear me?
@zz85
zz85 / print.js
Last active June 10, 2023 19:16
Pretty Print JSON in Ascii Tree
// TODO add colors
sample = { a: { b: { c: 1, moo: [3,2,1] } }, z: 'zzzz' }
const asciitree = require('ascii-tree');
function pretty_json(v) {
console.log(JSON.stringify( v, 0, 2 ))
}