Skip to content

Instantly share code, notes, and snippets.

View lazd's full-sized avatar

Larry Davis lazd

View GitHub Profile
@lazd
lazd / SomeClass.js
Created January 17, 2014 21:10
Private variables in ES5. Technique adapted from http://fitzgeraldnick.com/weblog/53/
var SomeClass = (function() {
// We'll store in an object to be as light as possible
var privates = {};
// Each instance will get its own ID
var nextId = 0;
function SomeClass() {
// Store a non-writable property called _
@lazd
lazd / .bash_aliases
Created January 23, 2014 18:44
Git aliases
# Git
alias gs="git status"
alias gc="git commit"
alias gca="git commit --amend"
alias ga="git add"
alias gp="git push"
alias gr="git pull --rebase"
alias gl="git log"
alias gd="clear; git diff"
@lazd
lazd / position.md
Created January 26, 2014 04:31
CSSBasics: Position

The position property

Position is one of the most misunderstood CSS values, and it's also the one you should know the best. Read on for the details.

static - Positioned in the flow of the document

Default value for all elements. The element will flow in the document according to its properties and the properties of the elements around it (namely display and float).

relative - Static with offset

@lazd
lazd / Names.md
Last active August 29, 2015 13:56
A sample of template markup from a new, as yet unnamed, template system

Potential names:

  • domly - like Dolly the sheep, DOMly uses cloneNode and createElement to be fast (via Aysegul Yonet). 🐑
  • dolly - like Dolly the sheep, the language clones HTML" (via Aysegul Yonet)
  • doml - dom language
  • domtl - dom template language
  • domtml - dom template markup language
  • tmul - "template mark-up language" (via Parag Tope)
    • Also stands for "The Milwaukee Urban League" and a problem code from SPOJ
  • templet - "root word of template, petite version of template" (via Parag Tope)
@lazd
lazd / domly-example.html
Created February 25, 2014 06:42
DOMly Example
<div>
<h1>Category: {{data.category}}</h1>
<if data.items.length>
<ul>
<foreach data.items>
<li>
<h2>{{parent.category}}: {{data.name}}</h2>
<h3 if-data.sale='class="sale"'>{{data.rice}}</h3>
<h3>{{formatCount(data.stockCount)}} in stock</h3>
<button unless-data.stockCount='disabled="disabled"'>Buy now</button>
@lazd
lazd / mixin.js
Last active August 29, 2015 14:01
Mixin Question
// Define a class
var A = Class({
toString: 'A',
// Define a method
method: function() {
return 'ClassA';
}
});
var boxMaterial = new THREE.LineBasicMaterial({
color: new THREE.Color('red')
});
// Create the lines for the "2D box"
var boxGeometry = new THREE.Geometry();
boxGeometry.vertices.push(new THREE.Vector3(-1, 0, 0));
boxGeometry.vertices.push(new THREE.Vector3( 0, 1, 0));
boxGeometry.vertices.push(new THREE.Vector3( 1, 0, 0));
boxGeometry.vertices.push(new THREE.Vector3( 0, -1, 0));
@lazd
lazd / shader.c
Created November 26, 2014 02:11
shader
uniform vec3 glowColor;
uniform float coeficient;
uniform float cutoff;
uniform float power;
varying vec3 vVertexNormal;
varying vec3 vVertexWorldPosition;
void main(){
vec3 worldCameraToVertex = vVertexWorldPosition - cameraPosition;
@lazd
lazd / Backbone.SuperRouter.js
Created February 17, 2015 06:21
A super-charged Backbone router
Backbone.SuperRouter = Backbone.Router.extend({
// The name of the application (used when setting title)
appName: 'MyApp',
// The default route
homeRoute: '/',
// List of URLs to avoid tracking
noTrack: [],
@lazd
lazd / master.js
Created March 3, 2015 21:21
DOMly Issue #22: master
this["templates"] = {};
this["templates"]["Advanced"] = (function anonymous(data_0) {
var data = data_0;
var el0 = document.createElement("div");
el0.className = "person";
var el2 = document.createElement("h1");
el2.className = "name";
el2.textContent = data_0["name"];
el0.appendChild(el2);
var el4 = document.createElement("h2");