Skip to content

Instantly share code, notes, and snippets.

View gdibble's full-sized avatar
🤩
Optimistic

Gabriel Dibble gdibble

🤩
Optimistic
View GitHub Profile
@gdibble
gdibble / startup-image-loader.js
Created April 20, 2015 20:50
iOS Launch Image Loader - meta tags load every image (many large files slow app load/render); this loads only appropriate image
/*
* 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
@gdibble
gdibble / bootstrap-popover-keeponhover.js
Last active August 29, 2015 14:19
bootstrap popovers stay on hover
/*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');
/*
* 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)) {