Skip to content

Instantly share code, notes, and snippets.

Avatar
:octocat:
...

Norman Rusch schorfES

:octocat:
...
View GitHub Profile
@schorfES
schorfES / console.search.js
Created Nov 10, 2017
Dev tools snippet for searching props in objects
View console.search.js
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);
}
@schorfES
schorfES / sharecounts.md
Last active Dec 10, 2015 — forked from jonathanmoore/gist:2640302
Get the share counts from various APIs
View sharecounts.md

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 / JSPM with Travis CI Setup.md
Last active Dec 3, 2015 — forked from topheman/jspm.travis.setup.md
Travis setup of Github token for jspm
View JSPM with Travis CI Setup.md
@schorfES
schorfES / bounding-box.js
Last active May 23, 2018
Calculate the bounding box of a DOM element with jQuery
View bounding-box.js
/**
* 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 / modernizr.positionfixed-tablepadding.js
Created Nov 7, 2014
Test if browser supports padding in elements which behave like tables and are positioned fixed.
View modernizr.positionfixed-tablepadding.js
/**
* 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 / WebappStandaloneDetect.js
Last active Dec 26, 2015
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
View WebappStandaloneDetect.js
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() {