Skip to content

Instantly share code, notes, and snippets.

View schorfES's full-sized avatar
🍫
...

Norman Rusch schorfES

🍫
...
View GitHub Profile
@schorfES
schorfES / WebappStandaloneDetect.js
Last active December 26, 2015 12:29
This detects if the application runs in iOS standalone mode and manually opens clicked links in webapps on homescreen to prevent switch to safari app. The code is designed to be used as backbone.geppetto command. See also: https://github.com/ModelN/backbone.geppetto#implementing-a-command
define(function(require) {
var
$ = require('jquery'),
Command = function() {}
;
/* This detects if the application runs in iOS standalone mode and
/* manually opens clicked links in webapp */
Command.prototype.execute = function() {
@schorfES
schorfES / modernizr.positionfixed-tablepadding.js
Created November 7, 2014 14:36
Test if browser supports padding in elements which behave like tables and are positioned fixed.
/**
* Test if browser supports padding in elements which behave like tables
* and are positioned fixed.
*/
Modernizr.addTest('positionfixed-tablepadding', function(){
return Modernizr.testStyles('#modernizr', function(elem) {
var
doc = document,
@schorfES
schorfES / bounding-box.js
Last active May 23, 2018 19:02
Calculate the bounding box of a DOM element with jQuery
/**
* Calculate the bounding box of a DOM element.
*
* @param element is the jQuery element which is the root of the calculation
*/
function getBoundingBox(element) {
var
position = element.offset(),
width = element.outerWidth(),
height = element.outerHeight(),
@schorfES
schorfES / JSPM with Travis CI Setup.md
Last active December 3, 2015 12:32 — forked from topheman/jspm.travis.setup.md
Travis setup of Github token for jspm
@schorfES
schorfES / sharecounts.md
Last active December 10, 2015 11:21 — forked from jonathanmoore/gist:2640302
Get the share counts from various APIs

Socialnetworks Share Counts

Many of these API calls and methods are undocumented, so anticipate that they will change in the future. Also, if you are planning on rolling these out across a site I would recommend creating a simple endpoint that periodically caches results from all of the APIs so that you are not overloading the services will requests.

Twitter

GET URL:

@schorfES
schorfES / console.search.js
Created November 10, 2017 10:55
Dev tools snippet for searching props in objects
console.search = console.search || function (obj, key, path = '.') {
Object.keys(obj).forEach(function(k) {
var o = obj[k];
if (!o) {
return;
}
if (k.toLowerCase() === key.toLowerCase()) {
console.log(path + k);
}