Skip to content

Instantly share code, notes, and snippets.

View jiggliemon's full-sized avatar

Chase Wilson jiggliemon

View GitHub Profile
@jiggliemon
jiggliemon / Events.js
Created June 10, 2011 07:36
How to handle the FB js sdk
if(window.sml){
sml.ns('sml.util');
}
;(function(ns){
var Events = ns.Events = function(options){
var _events = {}
,key;
for(key in options){
@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] || {};
<script>
var radical = function(name){
alert(name || 'Random');
}
exports.radical = radical;
</script>
@jiggliemon
jiggliemon / eventsmod.js
Created July 22, 2011 06:18
Mootools Events modification
var Events = new Class({
Extends: Events,
$events: {},
addEvent: function(type, fn, internal){
var events = this.$events[type] = this.$events[type] || [];
if(events == 1){
fn();
return this;
} else {
@jiggliemon
jiggliemon / FBready.js
Created August 16, 2011 02:34
A Better way to handle window.fbAsyncInit
/*
Requires:
- Events: https://gist.github.com/884484
- Extend: https://gist.github.com/1049896
- Namespace: https://gist.github.com/1006005
*/
SML = Object.namespace('SML',new Events);
window.fbAsyncInit = function(){
if (!Function.prototype.construct)
Function.prototype.construct = function(aArgs) {
if (aArgs.constructor !== Array)
throw new TypeError("second argument to Function.prototype.construct must be an array");
var aBoundArgs = Array.prototype.concat.apply([null], aArgs),
fBound = this.bind.apply(this, aBoundArgs);
return new fBound();
@jiggliemon
jiggliemon / FB.init.detector.js
Created August 16, 2011 18:33
Facebook Init detector!
$(document).bind('FB.ready',function(){
console.log('FB is ready');
FB.api('/me',function(response){
console.log(response);
});
});
var _FB = {
count: 0
,interval : setInterval(function(){
(function(jq){
var _events = [];
var _FB = {
count: 0
,interval : setInterval(function(){
try{
if(FB._session && (typeof FB._session !== 'undefined')){
clearInterval(_FB.interval);
jq.each(_events, function(indexhereisretarded,fn){
fn();
sml.adapter.jquery.Facebook.share = function(options) {
options = options || {};
/*
* All this ugliness went down because facebook
* dropped their 'attachment' property in their SDK
*/
var attachment = options.attachment = options.attachment || {};
var share = {
caption:"{{ facebook_page_name }}",
method: options.method || 'feed',
@jiggliemon
jiggliemon / State.js
Created September 23, 2011 00:30
Simple State Object
(function(global,_NAMESPACE_){
var State = _NAMESPACE_.State = function(){
return {
_states:{}
,_stateData: {}
,setState: function(name, data) {
if(this._states[name] && typeof data == 'undefined'){
this.setState(this._states[name]);
return false;
}