Skip to content

Instantly share code, notes, and snippets.

@jaubourg
jaubourg / Events.js
Created November 23, 2011 00:37 — forked from DaveStein/Events.js
Singleton wrapper around $.Callbacks to emulate Backbone events
var Event = (function( $ ) {
var cache = {},
slice = [].slice,
fake = {
remove: $.noop,
fireWith: $.noop
};
function get( ev, createIfNeeded ) {
@jaubourg
jaubourg / gist:948434
Created April 29, 2011 15:09 — forked from danheberden/gist:948429
making $.when() always report one arg
var getName = (function() {
var cache; // private cache
// gets assigned to getName
return function() {
// return the cache if it's valid or
return cache || $.ajax({
url: 'srv/echo',
<?php
## Nav data, as a JSON heredoc. Much less verbose than PHP arrays!
$navs = json_decode(<<<JSON
{
"mlb": {
"title_link": "http://stats.boston.com/mlb/scoreboard.asp",
"nav": [
{ "title": "Full Schedule", "url": "http://stats.boston.com/mlb/teamreports.asp?tm=02&report=schedule" },
{ "title": "Statistics", "url": "http://stats.boston.com/mlb/teamreports.asp?yr=2009&tm=2&btnGo=Go&report=stats" },
@jaubourg
jaubourg / typeOf.js
Created February 16, 2010 10:18 — forked from rkatic/README.md
(function($){
var toString = Object.prototype.toString;
var class2type = {
"[object Boolean]": "boolean",
"[object Number]": "number",
"[object String]": "string",
"[object Function]": "function",
"[object Array]": "array",