Skip to content

Instantly share code, notes, and snippets.

View chambaz's full-sized avatar

chambaz chambaz

View GitHub Profile
@chambaz
chambaz / main.js
Created June 6, 2012 13:47
RequireJS - Body Class Initiated Object Oriented AMD Module Pattern
require(["jquery"], function($) {
// grab and instantiate page modules
if($('body').attr('data-js')) {
var htmlData = $('body').attr('data-js').split(" "), deps = [], params = [], i;
for(i = 0; i < htmlData.length; i++) {
// remove prefix
@chambaz
chambaz / main.js
Created June 15, 2012 11:01
Simple Fading Content Rotator
var // slides are direct descendants of $featured
$featured = $('.holder'),
featuredExists = !!$featured,
featuredTimer = null,
// animation options
featuredOpts = {
delay: 1000, // initial delay before first slide fades in
interval: 4000, // time between slide animation
fade: 500 // fade duration fadeing out and in
};
@chambaz
chambaz / Desk.js
Created June 18, 2012 11:30
Mixing Desk Example
/**
* Mixing Desk
* -----------
*/
function Desk(band) {
var _this = this;
this.band = arguments;
this.path = 'audio/';
@chambaz
chambaz / Synth.js
Created June 18, 2012 11:30
DS Pad Example
/**
* DS Pad
* ------
*/
function Synth() {
var _this = this;
this.$stage = $('#pad');
@chambaz
chambaz / wp_posts_pivot.sql
Last active August 29, 2015 13:56
Query Wordpress for posts with associated meta data
SELECT p.ID,
p.post_title,
p.post_date,
p.post_excerpt,
p.post_content,
MAX(CASE WHEN pm.meta_key = '_aioseop_description' then pm.meta_value ELSE NULL END) as meta_description,
MAX(CASE WHEN pm.meta_key = '_aioseop_title' then pm.meta_value ELSE NULL END) as meta_title
FROM wp_posts p LEFT JOIN wp_postmeta pm ON ( pm.post_id = p.ID)
@chambaz
chambaz / foreach.js
Created February 8, 2014 23:39
Array.forEach Polyfill
if (!Array.prototype.forEach)
{
Array.prototype.forEach = function(fun /*, thisArg */)
{
"use strict";
if (this === void 0 || this === null)
throw new TypeError();
var t = Object(this);
@chambaz
chambaz / share-tools.html
Created February 24, 2014 13:13
Conditional Loading of Share Tools with ResponsiveComments - http://responsivecomments.com/
<ul class="share-tools" data-responsive-comment-media="(min-width: 48em)">
<!--
<li><div class="fb-like" data-href="http://www.digitalsurgeons.com" data-layout="box_count" data-action="like" data-show-faces="false" data-share="false"></div></li>
<li><a href="https://twitter.com/share" class="twitter-share-button" data-url="http://www.digitalsurgeons.com" data-count="vertical">Tweet</a></li>
<li><div class="g-plusone" data-size="tall"></div></li>-->
</ul>
@chambaz
chambaz / custom-event.js
Created March 24, 2014 17:07
Polyfill for CustomEvent() constructor functionality in Internet Explorer 9 and 10
(function () {
function CustomEvent ( event, params ) {
params = params || { bubbles: false, cancelable: false, detail: undefined };
var evt = document.createEvent( 'CustomEvent' );
evt.initCustomEvent( event, params.bubbles, params.cancelable, params.detail );
return evt;
};
CustomEvent.prototype = window.Event.prototype;
@chambaz
chambaz / audiolib.js
Created September 6, 2014 14:32
AudioLib
/*
audiolib.js
Jussi Kalliokoski
https://github.com/jussi-kalliokoski/audiolib.js
MIT license
*/
/*
wrapper-start.js
Please note that the file is not of valid syntax when standalone.