Skip to content

Instantly share code, notes, and snippets.

@rezoner
rezoner / gist:3885077
Created October 13, 2012 15:47
Asynchronous parallel - different approach
/* usage:
parallel(
func1, [arg, arg, arg...],
func2, [arg, arg, arg...],
...
function() {
arguments[0]; // holds output from first function
arguments[1]; // holds output from second function
}
@rezoner
rezoner / gist:3885097
Created October 13, 2012 15:52
2D Align function
/*
Go to CSS deck to understand how it works
http://cssdeck.com/labs/mtmn9aph/0
*/
function align (boundX, boundY, boundW, boundH, objectW, objectH, boundAlignX, boundAlignY, objectAlignX, objectAlignY) {
var result = [];
@rezoner
rezoner / simploader.js
Last active December 10, 2015 18:29
Super simple javascript image loader.
/* usage:
var image = new Image;
simploader(image); // also accept array of images
image.src = "something.png";
simploader(function() {
@rezoner
rezoner / gist:5094633
Created March 5, 2013 21:50
Easing equations according to /* (c) GSGD - http://gsgd.co.uk/sandbox/jquery/easing */
var easings = {
linear: function(t, b, c, d) {
return c * t / d + b;
},
inQuad: function(t, b, c, d) {
return c * (t /= d) * t + b;
},
@rezoner
rezoner / pageflowcontrollers.js
Created March 7, 2013 20:20
Page flow controllers examples
/* example Kohana/CodeIgniter like controller */
module.exports = {
default: function(args, callback) {
},
article: function(args, callback) {
/*
Playground 1.1
http://canvasquery.org
(c) 2012-2014 http://rezoner.net
Playground may be freely distributed under the MIT license.
*/
function playground(args) {
return new Playground(args);
};
@rezoner
rezoner / easings.js
Created March 2, 2015 17:27
One argument easing equations
/*
A full list of simple easing equations inspired by GIST from greweb - https://gist.github.com/gre/1650294
Equations source - http://gsgd.co.uk/sandbox/jquery/easing/
*/
{
linear: function(t) {
return t
},
inQuad: function(t) {
@rezoner
rezoner / gist:362b5da4f3d6e01c9442
Created March 22, 2015 19:48
Playground with Three.js - draft 1
var app = playground({
create: function() {
this.renderer = new THREE.WebGLRenderer();
document.body.appendChild(app.renderer.domElement);
},
@rezoner
rezoner / gist:86b59077e39c42fdbf06
Created March 23, 2015 09:45
Playground with Three.js - draft 2
var app = playground({
use: {
"three": {
renderer: "webgl"
},
},
@rezoner
rezoner / gist:5fd6de20d4a00775fe89
Created March 23, 2015 12:14
Playground - ThreeJS bootstrap plugin
/*
ThreeJS bootstrap plugin
Sets up three.js render for an application
Sets up separate camera and scene for each state
*/
playground.plugins.three = {