Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am fdn on github.
  • I am fdn (https://keybase.io/fdn) on keybase.
  • I have a public key whose fingerprint is 3837 EE29 D0BE 95A2 3956 C4D8 4ED2 18FF F2E2 E780

To claim this, I am signing this object:

@fdn
fdn / 8.1 Create a Broken Client Script
Last active May 11, 2016 19:38
K16 Mobile Lab Snippets
function onSubmit() {
// we did some validation?
if (isValidated) {
console.log('Form checks out!');
}
return true;
}
angular.module('appModuleName').config(function() {
'use strict';
var JQLite = angular.element;
/**
* Augment find() to support selectors
*/
var _find = JQLite.prototype.find;
@fdn
fdn / console.log grouped
Last active August 29, 2015 14:01
Simple fork of console.log with call location to add grouping. Grouping helps cut down on the visual noise in the log.
/**
* Console.log with call location and grouping to reduce log noise.
* Apply directly to code once.
*
* Original: http://remysharp.com/2014/05/23/where-is-that-console-log/
*/
var groupable = typeof console.groupCollapsed !== 'undefined';
['log', 'warn'].forEach(function(method) {
var old = console[method];
console[method] = function() {
@fdn
fdn / gist:8465684
Created January 16, 2014 23:41
isInViewport(el)
// via http://blog.adtile.me/2014/01/16/a-dive-into-plain-javascript/
// Determine if an element is in the visible viewport
function isInViewport(element) {
var rect = element.getBoundingClientRect();
var html = document.documentElement;
return (
rect.top >= 0 &&
rect.left >= 0 &&
rect.bottom <= (window.innerHeight || html.clientHeight) &&
rect.right <= (window.innerWidth || html.clientWidth)