Skip to content

Instantly share code, notes, and snippets.

🌲
lost in the woods

Tim Branyen tbranyen

🌲
lost in the woods
Block or report user

Report or block tbranyen

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View each.js
// 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
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
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];
}
@tbranyen
tbranyen / jquery.dom.js
Created Aug 23, 2010
potential new load filter
View jquery.dom.js
// 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
(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) {
@tbranyen
tbranyen / handler-jquery.js
Created Dec 1, 2010
jquery plugin example
View handler-jquery.js
(function(window, $) {
$.fn.renderTemplate = function(paths) {
var template, context;
// Fetch template and context block
// Render block
@tbranyen
tbranyen / handler-dijit.js
Created Dec 1, 2010
dojo widget implementation
View handler-dijit.js
dojo.provide("dojox.widget.RenderTemplate");
dojo.require("dijit._Widget");
dojo.declare("dojox.widget.RenderTemplate",
dijit._Widget,
{
postCreate: function() {
this.inherited(arguments);
},
@tbranyen
tbranyen / handler.js
Created Dec 1, 2010
handler file with ajax functionality added in
View handler.js
(function(window) {
window.renderTemplate = function() {
var template, context;
// Handle ajax requests
var ajax = function() {
// Create normalized xhr object
function xhr() {
// To stifile any exceptions
@tbranyen
tbranyen / handler.js
Created Dec 1, 2010
handler code with render functionality added
View handler.js
(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
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Detect Credit Card Type</title>
</head>
<body>
You can’t perform that action at this time.