This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Flatten Object @gdibble: Inspired by https://gist.github.com/penguinboy/762197 | |
* input: { 'a':{ 'b':{ 'b2':2 }, 'c':{ 'c2':2, 'c3':3 } } } | |
* output: { 'a.b.b2':2, 'a.c.c2':2, 'a.c.c3':3 } | |
*/ | |
var flattenObject = function(ob) { | |
var toReturn = {}; | |
var flatObject; | |
for (var i in ob) { | |
if (!ob.hasOwnProperty(i)) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*global $*/ | |
/* | |
* bootstrap popovers stay on hover [4/11/2014 @gdibble] | |
*/ | |
var originalLeave = $.fn.popover.Constructor.prototype.leave; | |
$.fn.popover.Constructor.prototype.leave = function (obj) { | |
var self, container; | |
if (obj.currentTarget) { | |
self = obj instanceof this.constructor ? obj : $(obj.currentTarget)[this.type](this.getDelegateOptions()).data('bs.' + this.type); | |
container = $(obj.currentTarget).siblings('.popover'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* iOS Launch Image Loader v1.1.1 @ GDibble | |
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * | |
* Browser downloads all meta-tagged images, thus only append 1 meta tag to | |
* save download time and provide the fastest loading mobile experience. | |
* | |
* Files must live in '/img/ios/' and named: | |
* startup-2048x1496.png Landscape Retina iPads | |
* startup-1536x2008.png Portrait Retina iPads | |
* startup-1024x748.png Landscape iPad 1 & 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* return random number within lower/upper range | |
* output a whole number by passing returnInteger=1 | |
* Examples: $R(0, 10); >>> 3.141592653589793 | |
* $R(0, 10, 1); >>> 7 | |
*/ | |
function $R(lowerLimit, upperLimit, returnInteger) { | |
var step1 = Math.random() * (upperLimit - lowerLimit); | |
if (returnInteger && (returnInteger === 1)) { | |
return lowerLimit + parseInt(step1, 10); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Regular Expresion IndexOf for Arrays | |
* This little addition to the Array prototype will iterate over array | |
* and return the index of the first element which matches the provided | |
* regular expresion. Note: This will not match on objects. | |
* @param {RegEx} rx The regular expression to test with. E.g. /-ba/gim | |
* @return {Numeric} -1 means not found | |
*/ | |
if (typeof Array.prototype.reIndexOf === 'undefined') { | |
Array.prototype.reIndexOf = function (str) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Detection: http://gist.github.com/df3fd4016e632344336f3227a6f159e6 | |
* While userAgent sniffing is not ideal, arguably it is best in most cases | |
* throw in some proper feature detection & this will give you vast UI/UX control | |
*/ | |
var userAgent = navigator.userAgent || navigator.vendor || window.opera || navigator.platform; | |
this.isMobile = (function (browserUserAgent) { return /(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(browserUserAgent) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|n |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.grab-cursor | |
cursor: url('http://www.google.com/intl/en_ALL/mapfiles/openhand.cur'), all-scroll | |
cursor: url('data:image/vnd.microsoft.icon;base64,AAACAAEAICACAAcABQAwAQAAFgAAACgAAAAgAAAAQAAAAAEAAQAAAAAAAAEAAAAAAAAAAAAAAgAAAAAAAAAAAAAA////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD8AAAA/AAAAfwAAAP+AAAH/gAAB/8AAA//AAAd/wAAGf+AAAH9gAADbYAAA2yAAAZsAAAGbAAAAGAAAAAAAAA//////////////////////////////////////////////////////////////////////////////////////gH///4B///8Af//+AD///AA///wAH//4AB//8AAf//AAD//5AA///gAP//4AD//8AF///AB///5A////5///8='), all-scroll | |
cursor: -webkit-grab | |
cursor: -moz-grab | |
cursor: -o-grab | |
cursor: -ms-grab | |
cursor: grab | |
.grabbing-cursor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function clone(thing, opts) { | |
var newObject = {}; | |
if (thing instanceof Array) { | |
return thing.map(function (i) { return clone(i, opts); }); | |
} else if (thing instanceof Date) { | |
return new Date(thing); | |
} else if (thing instanceof RegExp) { | |
return new RegExp(thing); | |
} else if (thing instanceof Function) { | |
return opts && opts.newFns ? new Function('return ' + thing.toString())() : thing; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* intersectionObj | |
* Pass an array of objects to find the similar objects | |
* You may also pass a single prop as a string, or an array of props to ignore | |
* Returns an array of the items which intersected | |
* | |
* Usage example: | |
* var arr = [ { id:1, b:2, c:3 }, { id:2, b:3, c:4 }, { id:3, b:2, c:3 } ]; | |
* _.intersectionObj(arr, 'id'); | |
* » [ { id:1, b:2, c:3 }, { id:3, b:2, c:3 } ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @function findDateRanges | |
* @description Find and group date-ranges in an Array of dates | |
* | |
* @param {Array} sourceCollection - containing ISODateStrings in any order | |
* @param {?Array} destinationCollection - defaults to [] | |
* | |
* @returns {Array} - ^destinationCollection passed or new Array | |
* | |
* @example findDateRanges([ |
OlderNewer