View each.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Collection iterator | |
self.each = function(_collection, _callback) { | |
var method, index, item, collection, keys, wrapper, | |
index_r = "i", | |
item_r = "_collection[i]", | |
collection_r = "_collection"; | |
// Normal collection | |
if(_collection.length > 0 || _collection instanceof Array) { | |
method = true; |
View models.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var user = { | |
username: { type: String, required: true }, | |
password: { type: String, required: true }, | |
valueOf: "username" | |
}; | |
var tweet = { | |
source: { type: String, default: "Web" }, | |
created_at: { type: Date, default: new Date() }, |
View gist:505756
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if(typeof _selector == "string") { | |
if(cache[_selector]) | |
return cache[_selector]; | |
window.setTimeout(function() { delete cache[_selector]; }, 0); | |
cache[_selector] = dom.query(_selector); | |
return cache[_selector]; | |
} |
View jquery.dom.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// The idea is to create a DOM based off an xml string passed to it. Very very rough draft of what this would look like. | |
// Working example @ http://tabdeveloper.com/jquery/load/ | |
// Current problems are that <html>,<head>, and <body> tags are currently stripped from load's filter and that external resource | |
// are requested because the original load uses a 'dummy div'. This code attempts to solve both issues. | |
jQuery.dom = function(xmlstr) { | |
var doc; | |
// Start with standards compliant browsers first since they own | |
if("DOMParser" in window) { |
View handler.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(window) { | |
window.renderTemplate = function() { | |
var template, context; | |
// AJAX implementation block | |
// Container node to render template into and paths to template and context | |
return function(node, paths) { |
View handler-jquery.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(window, $) { | |
$.fn.renderTemplate = function(paths) { | |
var template, context; | |
// Fetch template and context block | |
// Render block |
View handler-dijit.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dojo.provide("dojox.widget.RenderTemplate"); | |
dojo.require("dijit._Widget"); | |
dojo.declare("dojox.widget.RenderTemplate", | |
dijit._Widget, | |
{ | |
postCreate: function() { | |
this.inherited(arguments); | |
}, |
View handler.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(window) { | |
window.renderTemplate = function() { | |
var template, context; | |
// Handle ajax requests | |
var ajax = function() { | |
// Create normalized xhr object | |
function xhr() { | |
// To stifile any exceptions |
View handler.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(window) { | |
// Required dojo template references | |
dojo.require("dojox.dtl"); | |
dojo.require("dojox.dtl.Context"); | |
window.renderTemplate = function() { | |
var template, context; | |
// Handle ajax requests | |
var ajax = function() { |
View DetectCreditCardType.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>Detect Credit Card Type</title> | |
</head> | |
<body> |
OlderNewer