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 stringStartsWith(search, coll, prop, transform){ | |
return coll.filter(function(item){ | |
var key = transform ? transform(item[prop]) : item[prop]; | |
return key.indexOf(search) === 0 | |
}); | |
} | |
function reverse(str){ | |
return str.split('').reverse().join('') | |
} |
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
jQuery.fn.withOverflowingChildren = function (cb) { | |
var parent = jQuery(this); | |
var p = parent.get(0); | |
var children = parent.find('> *'); | |
var len = children.length | |
var parentCoords = p.getBoundingClientRect(); | |
var called = false | |
while(len){ | |
if(!isInParent(children.get(len -1))){ |
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
/* | |
-- EXAMPLE USES | |
<div wbr>long.html?var=one$20two</div> | |
-- With optional regex to override default | |
<div wbr regex="/(\&|-|\=|(the)|(20))/gi"> | |
long.html?var=one$20two | |
</div> |
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
@model Jobney.Casm.Web.Models.ManageDataBootstrapper | |
<div data-ng-app="Jobney.Casm.ManageApp" data-ng-controller="ManageAppCtrl"> | |
<ul class="tab-bar grey-tab"> | |
<!-- content here --> | |
</ul> | |
<div data-ui-view></div> | |
</div> | |
@section scripts |
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
var cache = {}; | |
function checkCache(key){ | |
if(cache[key]){ | |
return cache[key]; | |
} else { | |
// do some long/expensive action | |
// ex: calculation, ajax, etc... | |
cache[key] = Math.random(); | |
return cache[key]; | |
} |
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
var data = [{ | |
id: 1, | |
children: [{ | |
id: 2, | |
children: [{ | |
id: 3, | |
children: [{ | |
id: 4, | |
children: [] | |
}] |
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 throttledPromiseObserver(callbacks, maxPending, checkInterval) { | |
var remainingCalls = callbacks.length; | |
var pendingCalls = 0; | |
var callIdx = 0; | |
var _checkInterval = checkInterval || 100; | |
var _maxPending = maxPending || 0; | |
return Rx.Observable.create(bufferedPromiseCalls); | |
function bufferedPromiseCalls(observer) { |
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
var Game = { | |
init: init, | |
draw: draw | |
} | |
function init(name){ | |
this.name = name; | |
} | |
function draw() { |
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
JSON.stringify((function(){ | |
return Object.keys(window).filter(function(key) { | |
try { | |
var versionInfo = getVersionInfo(key) | |
return versionInfo.version | |
} catch (e) { | |
return false | |
} | |
}).map(getVersionInfo) |
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
$provide.decorator('$exceptionHandler', [ | |
'$delegate', '$window', '$log', '$stateParams', | |
function($delegate, $window, $log, $stateParams) { | |
return function(exception, cause) { | |
if ($window.trackJs) { | |
$log.debug('$exceptionHandler ::: $stateParams => ', angular.toJson($stateParams)); | |
$window.trackJs.track(exception); | |
} | |
$delegate(exception, cause); | |
}; |
OlderNewer