Skip to content

Instantly share code, notes, and snippets.

View zz85's full-sized avatar

Joshua Koo zz85

View GitHub Profile
@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 / 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 / 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 / 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 / Brain Dump
Last active August 29, 2015 14:20
Canvas Markup Langague
v: [
'#time-slider',
'#time-grid'
];
<vpanel>
<timeslider />
<timegrid />
</vpanel>
@zz85
zz85 / main.css
Created April 22, 2015 17:12
boilerplate
body {
}
@zz85
zz85 / gss_test.html
Created January 8, 2015 07:29
Testing GSS
<html>
<head>
<script>
GSS_CONFIG = {
worker: "bower_components/gss/dist/worker.js",
verticalScroll: !false
};
// also see https://raygun.io/blog/2014/06/next-gen-constraint-layouts-browser-grid-style-sheets/
@zz85
zz85 / README.md
Last active May 9, 2016 00:59
Easing Experiments
@zz85
zz85 / log.js
Created December 18, 2014 10:57
black background console log for code
function stretch(args) {
for (var i = 0, il = args.length; i<il; i++) {
var c = args[i];
args[i] += new Array(200).slice(c.length).join(' ');
}
return args;
}
@zz85
zz85 / drag.js
Last active July 26, 2022 19:00
Generic onDrag handler
/*
@author twitter.com/blurspline
*/
function handleDrag(element, ondown, onmove, onup, down_criteria) {
var pointer = null;
var bounds = element.getBoundingClientRect();
element.addEventListener('mousedown', onMouseDown);