View yiq.js
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 yiq(bgColor) { | |
var r = bgColor.r * 255, | |
g = bgColor.g * 255, | |
b = bgColor.b * 255; | |
var yiq = (r * 299 + g * 587 + b * 114) / 1000; | |
return (yiq >= 128) ? 'black' : 'white'; | |
} |
View lodashGetAlternative.js
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 get(obj, path, def) { | |
var fullPath = path | |
.replace(/\[/g, '.') | |
.replace(/]/g, '') | |
.split('.') | |
.filter(Boolean); | |
return fullPath.every(everyFunc) ? obj : def; | |
function everyFunc(step) { |
View Angular DI sort function
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 for alphabetical sort of Angular dependency injections | |
*/ | |
(function() { | |
var arr = ['$state', '$stateParams', '$rootScope', '$timeout', | |
'$templateCache', '$compile', 'googleMapService', | |
'actionCreateService', '$filter', 'configModel']; | |
arr.sort(function (a, b) { | |
a = a.replace('$', ''); |