Skip to content

Instantly share code, notes, and snippets.

View jiggliemon's full-sized avatar

Chase Wilson jiggliemon

View GitHub Profile
// 1: how could you rewrite the following to make it shorter?
bar['doSomething' + (foo?'':'Else')](el);
// 2: what is the faulty logic in the following code?
/*
var foo = 'hello';
@jiggliemon
jiggliemon / accordion.js
Created November 15, 2010 03:17
Simple Accordion Plugin
var Accordion = this.Accordion = function(element, options) {
this.element = jQuery(element);
this.options = jQuery.extend({}, this.defaults, options);
this.baffles = [];
this.initialize();
}; Accordion.prototype = {
defaults: {
title: 'h3',
preactivate: [0]
},
@jiggliemon
jiggliemon / Overlay.Mask.js
Created January 3, 2011 04:34
a simple Overlay class
if(!window.Overlay){
throw new Error('the Class "Overlay" doesn\'t appear to be present');
}
/*
* Overlay Mask
*/
(function($){
var Mask = {
@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",
@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 / thumbnails.js
Created May 4, 2011 08:25
This should contain the stand alone code for the tumbnails, and their related functionality
//
// The code in this file should:
// - build a thumbnail container
// - populate the container with thumbnails
// - when a thumbnail is clicked, the main image should be updated with the appropriate image
//
// This code should be optional, and initiate itself if included.
//
(function(){
var thumbContainer = document.createDocumentFragment();
@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 / typeof.js
Created June 3, 2011 00:02
Adds typeof fixes to typeof `ns.typeOf()`
;(function(global, namespace){
if(!namespace) namespace = global;
if(namespace.typeOf) return;
namespace.typeOf = function(item){
if (item == null) return 'null';
var thetype = typeof item;
if (thetype === 'object') {
if (item) {
if (typeof item.length === 'number' && !(value.propertyIsEnumerable('length')) && typeof value.splice === 'function') {
@jiggliemon
jiggliemon / jsonp.js
Created June 3, 2011 07:13
Simple jsonp helper.
(function(global,namespace){
if(!namespace) namespace = {};
if (!namespace._jsonp_id) namespace._jsonp_id = 0;
namespace.JSONP = function(url, options) {
if (!namespace._jsonp_id) {
namespace._jsonp_id = 0;
}
var doc = document,
head = doc.getElementsByTagName('head')[0] || doc.body,
@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]] || {};