Skip to content

Instantly share code, notes, and snippets.

View THEtheChad's full-sized avatar

Chad Elliott THEtheChad

View GitHub Profile
@THEtheChad
THEtheChad / whenToDropIt.js
Last active August 29, 2015 14:05 — forked from beacrea/whenToDropIt.js
A functional lookup to help you determine what to do when it's hot, based on your sitch. Original by Sir Coty Beasley.
function mySitch(situation){
var holla = 'I got the rolly on my arm and I\'m pouring Chandon.';
if(mySitch.LOOKUP.hasOwnProperty(situation)){
holla = [mySitch.LOOKUP[situation], mySitch.SUFFIX].join(' ');
}
alert(holla);
}
window.MAP = function(func){
var data = {}, definition = {}, defaults = {};
MAP.each(MAP._grab_, function(def){
var value = def.getter();
if(value) data[def.key] = value;
});
definition = MAP.find(MAP._map_, function(def){
// Store a copy of the original jQuery#removeClass method
var _originalMethod = $.prototype.removeClass;
// Replace the jQuery#removeClass method with our own
// custom function
$.prototype.removeClass = function(){
// Convert the arguments object into an array
var args = Array.prototype.slice.call(arguments);
@THEtheChad
THEtheChad / bsOpts.js
Last active August 29, 2015 14:00
Bootstrap Options Display
var factory = document.createElement('div');
var html = '<table class="bootstrapper" style="margin:auto;width:500px;position:absolute;top:10px;left:10px;background:#fff;border-spacing:10px;border-collapse:separate;font-size:14px;font-family:Arial">';
var opts = Bootstrapper.ensightenOptions;
for(key in opts){
html += '<tr>';
html += '<td style="text-align:right">' + key + '</td>';
html += '<td>' + opts[key] + '</td>';
html += '</tr>';
$(document).ajaxSuccess(function(evt, res, req){
// here's where we look for our signature
if('/apps/mytmobile/eservice/servlet/UserProfile' != req.url) return;
if(!/UPDATE_NAME/.test(req.data)) return;
// extract ['key=value'] pairs
var params = {}, data;
data = req.data;
data = decodeURIComponent(data);
$(document).ajaxSuccess(function(evt, res, req){
console.log(arguments);
var url = req.url || '';
var response = res.responseText || '';
var operation;
operation = /operation=(.+?)\&/i.exec(req.data);
operation = operation ? operation[1] : '';
var s = s_gi(s_mpcs_account);
// set defaults here
function S(){
if(!(this instanceof S)) return new S();
}
S.prototype = s;
// your code below
@THEtheChad
THEtheChad / autoload.js
Last active December 31, 2015 23:49
Facebook auto load
var results = document.getElementById('browse_result_area');
results.style.display = 'none';
function debounce(func, delay){
var timer;
return function(){
clearTimeout(timer);
timer = setTimeout(func, delay);
var contacts = [];
function add( firstName, lastName, phone, email ){
contacts[ contacts.length ] = {
firstName : firstName,
lastName : lastName,
phone : phone,
email : email
};
}
@THEtheChad
THEtheChad / autoCurry.js
Created October 20, 2013 03:10
Curry & AutoCurry
function toArray(arr, start){ return Array.prototype.slice.call(arr, start || 0) }
Function.prototype.curry = function(){
var __method = this, args = toArray(arguments);
return function(){
return __method.apply(this, args.concat(toArray(arguments)));
}
}
Function.prototype.autoCurry = function(numArgs){