Skip to content

Instantly share code, notes, and snippets.

View jiggliemon's full-sized avatar

Chase Wilson jiggliemon

View GitHub Profile
@jiggliemon
jiggliemon / index.js
Created February 25, 2012 23:17
blocks.js a module wrapper
define(['block/mixin','template/mixin', 'mediator/mixin'],
function ( BlockMixin, TemplateMixin, EventsMixin, undef ) {
var slice = Array.prototype.slice
,toString = Object.prototype.toString;
function typeOf (obj) {
return toString.call(obj).match(/\s([a-zA-Z]+)/)[1].toLowerCase()
}
@jiggliemon
jiggliemon / .DS_Store
Created February 8, 2012 00:43
A Simple Template constructor
@deepakjois
deepakjois / generate-fiddle.sh
Created December 4, 2011 02:32
A convenient way to generate Github gists and link them to JSFiddle.
#!/bin/sh
# Usage: generate-fiddle <folder>
# Creates a folder and adds some files commonly used with JSFiddle
set -e
# Create folder
mkdir $1
cd $1
@jiggliemon
jiggliemon / Extend.js
Created June 27, 2011 21:35
Extend properties
if(!Object.extend)
Object.extend = function(original){
var i = (original)?1:0
,args = arguments
,original = original || this
,length = args.length
,key,extended
for (; i < length; i++){
extended = args[i] || {};
@jiggliemon
jiggliemon / namespace.js
Created June 3, 2011 07:21
Simple namespacing function.
if(!Object.namespace)
Object.namespace = function( str ){
if(!str) return;
var i = 0
,base = window
,shards,length
if(str.indexOf("::") !== -1){
shards = str.split("::");
base = window[shards[0]] = window[shards[0]] || {};
@jiggliemon
jiggliemon / Hash.js
Created June 2, 2011 23:57
A General use Hash object with some helper methods.
;(function(global,namespace){
if(!namespace) namespace = global;
/*
---
name: Hash
authors: ["Chase Wilson"]
requires: [typeOf]
provides: [Hash]
...
*/
@jiggliemon
jiggliemon / Events.js
Created March 24, 2011 03:09
Custom Event Queue for Objects.
;(function () {
var REGEX = /:(latch(ed$)?)/i;
function removeLatched(type){
if(type.indexOf(':')){
if(REGEX.test(type)){
type = type.replace(REGEX,'');
this._latched[type] = 1
}
}
@jiggliemon
jiggliemon / jawbone.js
Created March 11, 2011 06:50
Jawbone Json
if(!window.Oakley){
Oakley = {};
if(!Oakley.products){
Oakley.products = {};
}
}
Oakley.products.jawbone = {
"product_key": "jawbone",