Skip to content

Instantly share code, notes, and snippets.

View milcktoast's full-sized avatar
🍂
Making Growth (art game)

Ash Weeks milcktoast

🍂
Making Growth (art game)
View GitHub Profile
@milcktoast
milcktoast / index.js
Created October 4, 2017 19:06
requirebin sketch
const createREGL = require('regl')
const mat4 = require('gl-mat4')
const { LineBuilder } = require('regl-line-builder')
const regl = createREGL()
const setupCamera = regl({
uniforms: {
view: mat4.identity([]),
projection: ({ viewportWidth, viewportHeight }) => {
const w = viewportWidth / 2
@milcktoast
milcktoast / index.js
Last active October 4, 2017 19:06
requirebin sketch
const createREGL = require('regl')
const mat4 = require('gl-mat4')
const { LineBuilder } = require('regl-line-builder')
const regl = createREGL()
const setupCamera = regl({
uniforms: {
view: mat4.identity([]),
projection: ({ viewportWidth, viewportHeight }) => {
const w = viewportWidth / 2
fetch(urlToFloatFile)
.then((res) => res.arrayBuffer())
.then((buffer) => {
var floatBuffer = new Float32Array(buffer)
console.log(floatBuffer)
})
@milcktoast
milcktoast / ember-model.js
Created August 5, 2015 03:48
ember-model patched for [email protected]
(function() {
var VERSION = '0.0.16';
if (Ember.libraries) {
Ember.libraries.register('Ember Model', VERSION);
}
})();
.liquid-container {
position: relative;
overflow: hidden;
/* without this, overflow:hidden won't take effect because the things
we're trying to hide are on a separate accelerated
context. Also, this prevents a tiny vertical jump when the
content switches to accelerated. */
-webkit-transform: translateY(0);
-moz-transform: translateY(0);
@milcktoast
milcktoast / git-stats.sh
Last active August 29, 2015 14:25
Author contribution stats (+/-) [with git and awk]
# /bin/sh
IFS=$'\n'
authors=$(git log --format='%aN' | sort -u)
for author in $authors
do
echo $author | awk 'BEGIN { FS = "\" " }; { printf "%-20s ", $1 }'
git log --author="$author" --pretty=tformat: --numstat |
awk '{ add += $1; subs += $2; edits += $1 + $2 } END { printf "%10d (+) %10s (-) %10s (+/-) \n", add, subs, edits }'
.liquid-container {
position: relative;
overflow: hidden;
/* without this, overflow:hidden won't take effect because the things
we're trying to hide are on a separate accelerated
context. Also, this prevents a tiny vertical jump when the
content switches to accelerated. */
-webkit-transform: translateY(0);
-moz-transform: translateY(0);
var get = Ember.get;
var set = Ember.set;
var HardLocation = App.HardLocation = Ember.Object.extend({
init : function() {
return set(this, 'location', get(this, 'location') || window.location);
},
getURL : function() {
var location = get(this, 'location');
@milcktoast
milcktoast / circleHeightfield.js
Created October 20, 2014 16:09
p2 heightfield interpolation
// Overwrite p2.Narrowphase.prototype.circleHeightfield
// Solves circle / heightfield collision with interpolated curve
// e.g. http://jsbin.com/mifixo/9/
/*jshint camelcase:false, maxparams: 15, maxcomplexity:15*/
var vec2 = p2.vec2;
var add = vec2.add;
var sub = vec2.sub;
var circleHeightfield_candidate = vec2.create();
@milcktoast
milcktoast / blender-upgrade
Last active August 29, 2015 14:03
Blender Upgrade
#! /bin/sh
# usage:
# $ blender-upgrade $version
VERSION=$1
SRC=~/Dropbox/config/blender/
DEST=/Applications/Blender/Blender.app/Contents/Resources/$VERSION/scripts/
cd $SRC;
for d in *