Skip to content

Instantly share code, notes, and snippets.

View CharlesAnifowose's full-sized avatar

Charles Anifowose CharlesAnifowose

View GitHub Profile
@CharlesAnifowose
CharlesAnifowose / 1-sync-scrolling.js
Last active August 29, 2015 14:18
synchronized scrolling of an arbitrary number of elements (this one is focused on y axis)
var scrollWatches = {};
var setupScrollWatch = function(id, _el){
if (!scrollWatches[id]){
scrollWatches[id] = [];
}
if (_.indexOf(scrollWatches[id], _el) == -1){
scrollWatches[id].push(_el);
$(_el).scroll(function(a,b){
syncToScroll(id, _el);
});
@CharlesAnifowose
CharlesAnifowose / dHrfs.markdown
Created June 9, 2014 00:56
A Pen by Charles Anifowose.
@CharlesAnifowose
CharlesAnifowose / deep-defaults.js
Last active January 1, 2016 22:09
Similar intention as Underscore's _.defaults() algorithm, but with the ability to go deep into objects. Function will error out if Objects have circular references. Dependencies: UnderscoreJS
function deepDefault(obj, source, depth, blankCheck){
if (depth===undefined){
depth=0;
}
if (depth>1000){
throw new Error('Too many iterations, possible circular reference');
return;
}
_.each(source, function(sourceVal, i){
var val = obj[i];