Convenience function for performing a groupBy
on a list then a sortBy
on the resulting groups using Underscore methods.
sortedGroupBy(list, groupByIterator, sortByIterator)
function createGuid() { | |
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) { | |
var r = Math.random()*16|0, v = c === 'x' ? r : (r&0x3|0x8); | |
return v.toString(16); | |
}); | |
} | |
// var uuid = createGuid(); | |
// >>> "e2ece964-0315-4b91-b411-20f9868ce7d4" |
Convenience function for performing a groupBy
on a list then a sortBy
on the resulting groups using Underscore methods.
sortedGroupBy(list, groupByIterator, sortByIterator)
var pattern0 = ^(?:(?:\+?1\s*(?:[.-]\s*)?)?(?:\(\s*([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9])\s*\)|([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9]))\s*(?:[.-]\s*)?)?([2-9]1[02-9]|[2-9][02-9]1|[2-9][02-9]{2})\s*(?:[.-]\s*)?([0-9]{4})(?:\s*(?:#|x\.?|ext\.?|extension)\s*(\d+))?$ | |
//This matches: Country indicator, Phone number, Extension | |
//(+351) 282 43 50 50 | |
//90191919908 | |
//555-8909 | |
//001 6867684 | |
//001 6867684x1 | |
//1 (234) 567-8901 |
// The library, go down to find actual code | |
(function () { | |
var AlwaysProgress = function AlwaysProgress(element, sync, expectedMaxSeconds) { | |
var progressed = 0, | |
stepCallbacks = [], | |
minInterval = 30, | |
interval = minInterval, | |
steps = 0, |
function eachAsync(iter, list, delay) { | |
var i = 0, | |
stopped = false, | |
fwhenDone; | |
delay = delay || 0; | |
function run() { | |
iter(list[i], done); | |
} | |
function hold() { |
(function ($) { | |
var event, | |
getEvent = function () { | |
return event || window.event; | |
}, | |
setEvent = function (ev) { | |
event = ev; | |
}; | |
// FireFox does not have a global event object. |
[ Launch: test ] 7f8498d86952bb26008b by devcodeio
(function() { | |
var arrays, basicObjects, deepClone, deepExtend, deepExtendCouple, isBasicObject, | |
__slice = [].slice; | |
deepClone = function(obj) { | |
var func, isArr; | |
if (!_.isObject(obj) || _.isFunction(obj)) { | |
return obj; | |
} | |
if (_.isDate(obj)) { |
function findKey(obj, value){ | |
var key; | |
_.each(_.keys(obj), function(k){ | |
var v = obj[k]; | |
if (v === value){ | |
key = k; | |
} | |
}); |
/** | |
* Original author: David Eads (https://github.com/eads) | |
* | |
* Wrap D3 charting components in a simple Backbone view interface | |
* | |
* Provides a redrawing path, data sync, and fallback for non-d3 browsers. | |
* | |
* Views that extend ChartView should implement their own "draw" function and go to work. | |
* | |
* var collection = new Backbone.Collection([ ["Maria", 33], ["Heather", 29] ]); |