Skip to content

Instantly share code, notes, and snippets.

@tJener
tJener / gist:5272212
Created March 29, 2013 17:16
HTML5 graphics demos
http://gradientstudios.github.com/canvas2d-lighting-demo/
http://jsfiddle.net/tJener/G4R99/
http://js1k.com/2013-spring/demo/1451
http://codeflow.org/webgl/deferred-irradiance-volumes/www/
http://www.ro.me/tech/hatching-glow-shader
http://mrdoob.github.com/three.js/examples/webgl_kinect.html
https://www.shadertoy.com/view/XslGRr
https://www.shadertoy.com/view/Xdl3R4
@tJener
tJener / gist:5160480
Last active December 14, 2015 22:39
Using escape key to trigger Pointer Lock.
<!DOCTYPE html>
<html>
<body>
<script type="text/javascript">
var elem = document.body;
var isLocked = false;
var escDown = false;
elem.requestFullscreen =
elem.requestFullscreen ||
@tJener
tJener / loc
Last active December 14, 2015 10:39
A LOC tool for git repositories, grouped by language and author.
#!/usr/bin/env perl
use strict;
use warnings;
use constant LOC_FILES_CMD => q(
xargs -n1 git blame --line-porcelain |
sed -n 's/^author //p' |
sort | uniq -c |
awk -F' author ' '{for(i=1;i<=NF;++i)printf$i OFS;print""}' |
#!/bin/sh
# Convert an image to YUV color space, then separating out the
# channels to visual the components of the YUV color space.
# Accept STDIN, use YUV colorspace, separate channels.
# 0. Black
# 1. Y channel
# 2. U channel negated
# 3. U channel
@tJener
tJener / gist:3758415
Created September 20, 2012 21:20
commonjs/amd boilerplate
// shamlessly stolen from lodash
/*global define:false*/
;(function( window, undefined ) {
var freeExports = false;
if ( typeof exports === 'object' ) {
freeExports = exports;
if ( exports && typeof global === 'object' && global && global === global.global ) { window = global; }
}
@tJener
tJener / binary-serialize-double.js
Created July 26, 2012 18:08
Network serialization
// Store number in Float64Array.
var arr = new Float64Array([ 15.290663048624992 ]);
// View the underlying ArrayBuffer as unsigned bytes.
var bytes = new Uint8Array( arr.buffer );
// Serialize to a string. Pay attention to endian in production code.
var str = [].map.call( bytes, function( byte ) {
return String.fromCharCode( byte );
}).join('');