Skip to content

Instantly share code, notes, and snippets.

View Iheartweb's full-sized avatar

Robert Martone Iheartweb

  • Google
  • Mountain View CA
View GitHub Profile
const fs = require("fs");
const utils = require("./utils");
const settings = require("./settings");
const [...fibonacciNumbers] = utils.fibonacci(30);
const phi = (1 + Math.sqrt(5)) / 2;
let frame = 0;
const height = settings.canvas.height * 25.4;
@Iheartweb
Iheartweb / jiteLu.js
Created December 11, 2012 06:38
Just in Time Execution for Lu
/**
* The code in this gist allows for just in time execution of Lu components.
* JITE will be a fall-back in browsers that don't support MutationObservation
* or MutationEvents or when a processor has not executed a component yet.
*/
function gatherDeferrals(components) {
var deferrals = [];
_.each(components, function (component) {
if (component.status !== 'ready') {
@Iheartweb
Iheartweb / map.js
Created October 24, 2012 19:30
Binding Lu to the View
( function(){
this.$mapped = $( [] );
this.Map = Fiber.extend( function(){
var Observer,
Maps = [],
observationSettings = {
childList: true,
subtree: true,
};
@Iheartweb
Iheartweb / model.js
Created October 24, 2012 19:24
Model! Yeah!
/**
* @class Model
*/
var Model = Fiber.extend( function(){
'use strict';
var defaults = {
//The primary key to use in the models
@Iheartweb
Iheartweb / gist:3934854
Created October 22, 2012 22:02
Keyboard Manager
/*
This maps the 'body' to a Lu component. you can also write a pattern like
$('[data-lu~=KeyManager]'). Abstract is our EventProvider - it is modeled
after and proxies jQuery events.
*/
Map.add( $( 'body' ), 'Abstract', function( $body ){
//A few things are available in this scope
//The settings that will be used
@Iheartweb
Iheartweb / accordian.html
Created May 29, 2012 21:51
Lu Accordian
<ul id="accordian" data-lu="List">
<li id="one" data-lu="Container" class="lu-state-selected">
<h2><a href="#one" data-lu="Button:Select">One</a></h2>
<div class="content">
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
@Iheartweb
Iheartweb / W00ZERZ.html
Created May 10, 2012 22:51
Content Editable Region.
<form data-lu="Form">
<div id="Bar" data-lu="Container" class="lu-state-edit">
<!-- Hit Enter to stop editing -->
<input class="Editor" type="text" value="FOO" name="Bar"/>
<!-- Click the link to edit -->
<h1><a href="#regressive-url" data-lu="Button:State:Edit">Foo</h1>
</div>
</form>
<button data-lu="Button:Switch" data-lu-config="{
'Button:Switch': {
states: '['a b', 'a c', 'a', 'b', 'c']'
}
}" type="button">AB/AC/A/B/C</button>
<button data-lu="Button:Switch" data-lu-config="{
'Button:Switch': {
states: 'a b'
}
}" type="button">AB</button>
<button data-lu="Button:Switch" data-lu-config="{
'Button:Switch': {
states: ['a', 'b', 'c']
}
}" type="button">A/B/C</button>