Skip to content

Instantly share code, notes, and snippets.

@jupiterjs
jupiterjs / Can you do.js
Created December 7, 2010 23:10
Can your framework do this?
//- CONTROLLER -
$.Controller("Tabs",{
"li click" : function(){
}
})
// will automatically create a jQuery plugin like:
@jupiterjs
jupiterjs / tie.js
Created December 8, 2010 09:14
Demonstrating some of tie's functionality.
/*
Tie lets you cross-bind form elements and controllers with models.
This means that by changing a model attribute, you it will
automatically update controllers or form elements.
This also means that if a 'change' event happens on the
element, it will automatically update the model attribute.
Lets see an example:
*/
@jupiterjs
jupiterjs / ListsAndJavaScriptMVC.js
Created February 8, 2011 00:18
Creating a todo list with JavaScriptMVC
// a helper for retrieving JSON data from localStorage
var localStore = function(name, cb, self){
var data = $.evalJSON( window.localStorage[name] || (window.localStorage[name] = "{}") ),
res = cb.call(self, data);
if(res !== false){
window.localStorage[name] = $.toJSON(data);
}
};
// A todo model for CRUDing todos.
@jupiterjs
jupiterjs / EOA.md
Created February 9, 2011 04:27
Async Events and Event Oriented Architectures

Event Oriented Architectures

When building JavaScript widgets, they should communicate with "outside" code similar to how native elements, especially form elements work. For example:

The anchor element.

Default Event: window.location = el.href Prevent Default : $(el).click(function(ev){ev.preventDefault()})

@jupiterjs
jupiterjs / Anifast.js
Created March 2, 2011 16:01
A jQuery animation helper that uses CSS Animations when available.
steal.plugins('jquery').then(function(){
var animationNum = 0,
//Animation events implies animations right?
suportsAnimations = !!window.WebKitAnimationEvent;
//gets teh last stylesheet or creates one
var getLastStyleSheet = function(){
if(!document.styleSheets.length){
var style = document.createElement('style');
@jupiterjs
jupiterjs / JavaScriptMVC.md
Created March 12, 2011 05:43
JavaScriptMVC Overview

Introduction

JavaScriptMVC is an open-source jQuery-based JavaScript framework. It is nearly a comprehensive (holistic) front-end development framework; packaging utilities for:

  • testing
  • dependency management
  • error reporting
  • package management
  • code cleaning
  • custom events
@jupiterjs
jupiterjs / Models and deferreds.js
Created March 17, 2011 01:49
How a JMVC Model that uses deferreds could / should look.
// The GOAL =========================
// 1. define a model
$.Model("Todo",{
findOne : function(params, success, error){
//some deferred gets returned here
}
},{
helperMethod : function(){ ... }
})
@jupiterjs
jupiterjs / Advanced jQuery.md
Created March 26, 2011 22:48
Advanced jQuery Outline

Goal

Train people on a complete stack outside of jQuery

Highlevel concepts

  • Dependency Management
  • Documentation
  • Error Reporting
  • Organization
@jupiterjs
jupiterjs / Steal.md
Created March 29, 2011 22:06
What steal does

you can steal all your scripts:

steal.plugins('foo/bar','abc')

then run the build app:

steal buildjs mypage.html

It finds all scripts, minifies, combines them into 1.

@jupiterjs
jupiterjs / Namespace.js
Created April 29, 2011 16:13
A proxy loader
(function(){
var getObject = function(name){
var parts = name.split('.'),
current = window,
part;
while(part = parts.shift()){
current = current[part];
}
return current;
},