Skip to content

Instantly share code, notes, and snippets.

View polyclick's full-sized avatar
👽
I see the matrix

polyclick polyclick

👽
I see the matrix
View GitHub Profile
@polyclick
polyclick / scene-draw-line.js
Last active August 29, 2015 14:19
Draw a line in threejs
// creates a white (!!) line from 0,0,0 to 300,0,0
// make sure background is other color than white ;)
var geometry = new THREE.Geometry();
geometry.vertices.push(new THREE.Vector3(0, 0, 0));
geometry.vertices.push(new THREE.Vector3(300, 0, 0));
var line = new THREE.Line(
geometry,
new THREE.LineBasicMaterial( { color: 0xffffff, linewidth: 1 } )
);
@polyclick
polyclick / default-parameter.js
Last active August 29, 2015 14:25
javascript default value parameter
param = typeof param !== 'undefined' ? param : default_value;
@polyclick
polyclick / scene-boilerplate.js
Created July 20, 2015 12:46
threejs cube boilerplate scene + tweenmax update ticker
'use strict';
function Application() {
this.camera = null;
this.scene = null;
this.renderer = null;
this.mesh = null;
this.init();
}
@polyclick
polyclick / jquery-ready-shorthand.js
Created July 23, 2015 13:39
jquery ready shorthand
$(function() {
// Handler for .ready() called.
});
@polyclick
polyclick / classjs-snippet.js
Created July 31, 2015 10:58
classjs init snippet
'use strict';
var ClassName = Class.extend({
init: function() {
// catch arguments here
// init class
}
});
// jquery fastclick integration
$(function() {
FastClick.attach(document.body);
});
this.$button.click(function(event){
event.preventDefault();
var $target = $(event.currentTarget);
// do stuff with target
}.bind(this));
@polyclick
polyclick / .eslintrc
Created September 28, 2015 19:53
.eslintrc configuration
{
// http://eslint.org/docs/rules/
"parser": "babel-eslint",
"env": {
"browser": true, // browser global variables.
"node": true, // Node.js global variables and Node.js-specific rules.
"worker": false, // web workers global variables.
"amd": false, // defines require() and define() as global variables as per the amd spec.
background-image: url('data:image/svg+xml;utf8,<svg></svg>');
#ifdef GL_ES
precision lowp float;
#endif
#define TWO_PI 6.28318530718
uniform sampler2D videoTexture;
varying vec2 vUv;
uniform vec3 colorA;