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 getInset(rectA, rectB) { | |
return { | |
top: (rectB.top - rectB.top), | |
right: (rectA.left + rectA.width) - (rectB.left + rectB.width), | |
bottom: (rectA.top + rectA.height) - (rectB.top + rectB.height), | |
left: rectB.left - rectB.left | |
}; | |
} |
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
// requestAnimationFrame() shim by Paul Irish | |
// http://paulirish.com/2011/requestanimationframe-for-smart-animating/ | |
window.requestAnimFrame = (function() { | |
return window.requestAnimationFrame || | |
window.webkitRequestAnimationFrame || | |
window.mozRequestAnimationFrame || | |
window.oRequestAnimationFrame || | |
window.msRequestAnimationFrame || | |
function(/* function */ callback, /* DOMElement */ element){ | |
window.setTimeout(callback, 1000 / 60); |
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 guid(){ | |
function s4() { | |
return Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1); | |
} | |
return s4() + s4() + '-' + s4() + '-' + s4() + '-' + | |
s4() + '-' + s4() + s4() + s4(); | |
} |
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 unique(in_list) { | |
var lookup = {}; | |
var values = []; | |
for (var i = 0; i < in_list.length; i++) { | |
if (!lookup[in_list[i]]) { | |
values.push(in_list[i]); | |
} | |
lookup[in_list[i]] = true; | |
} | |
return values; |
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
angular | |
.module('myProject', []) | |
.filter('abbreviate', function () { | |
// Hello World | abbreviate:6:2 //-> 'Hello...Wo' | |
// Hello World | abbreviate:5 //-> 'Hello...' | |
return function(str, num, prefix) { | |
if (str == null) { str = ''; } | |
if (num == null) { num = str.length; } | |
if (prefix == null) { prefix = 0; } |
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 memoize(fn) { | |
fn.memoize || (fn.memoize = {}); | |
return function(arg) { | |
if (fn.memoize.hasOwnProperty(arg)) { | |
console.log('memoized //-> %s', arg); | |
return fn.memoize[arg]; | |
} | |
else { | |
console.log('computed //-> %s', arg); | |
fn.memoize[arg] = fn(arg); |
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
it('Property', inject(function($parse){ | |
function Property(context, fieldName) { | |
this.$getter = $parse(fieldName); | |
this.$setter = this.$getter.assign; | |
this.$context = context; | |
} | |
Property.prototype.get = function() { | |
return this.$getter(this.$context); | |
}; | |
Property.prototype.set = function(value) { |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>Title with action buttons</title> | |
<style id="jsbin-css"> | |
.bar { | |
position: relative; | |
} |
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($, window, document, undefined) { | |
'use strict'; | |
var pluginName = 'FunnelViz' | |
, defaults = { | |
}; | |
function init () { |