David Brockman Smoliansky dbrockman

View enqueueCalls.js
1 2 3 4 5 6 7 8 9 10
function enqueueCalls(fn) {
return function() {
var bound = fn.bind.apply(fn, [null].concat([].slice.call(arguments, 0)));
if (queue) {
queue.push(bound);
}
else {
bound();
}
};
View code-loc.js
1 2 3 4
// Returns something like "at /path/to/file.js:190:37"
function code_loc() {
return ((new Error()).stack.split('\n')[2] || '').trim();
}
View other-file.js
1 2 3 4 5 6 7
var Thing = require('./thing.js');
 
var thing1 = Thing.sharedThing(...);
 
var thing2 = Thing(...);
 
var thing3 = new Thing(...);
View countTilesInRegion.m
1 2 3 4 5 6 7 8 9 10
- (NSUInteger)countTilesInRegionSouthWest:(CLLocationCoordinate2D)southWest
northEast:(CLLocationCoordinate2D)northEast
minZoom:(int)minZoom
maxZoom:(int)maxZoom
{
double minLat = southWest.latitude;
double maxLat = northEast.latitude;
double minLon = southWest.longitude;
double maxLon = northEast.longitude;
View shorten_number.js
1 2 3 4 5 6 7 8 9 10
var digits = '0123456789' +
'abcdefghijklmnopqrstuvwxyz' +
'ABCDEFGHIJKLMNOPQRSTUVWXYZ' +
'-_';
var radix = digits.length;
 
function shorten_number(n) {
var s = '';
while (n > 0) {
s = digits.charAt(n % radix) + s;
View flatten2D.js
1 2 3 4 5
function flatten2D(array) {
return array.reduce(function (result, item) {
return result.concat(item);
}, []);
}
View getBoundsAtLatLngWithZoom.js
1 2 3 4 5 6 7 8 9 10
function getBoundsAtLatLngWithZoom(map, center, zoom) {
var p = map.getProjection();
if (!p) {
return null;
}
var el = $(map.getDiv());
var zf = Math.pow(2, zoom) * 2;
var dw = (el.width() | 0) / zf;
var dh = (el.height() | 0) / zf;
var cpx = p.fromLatLngToPoint(center);
View example-output.html
1 2 3 4 5 6 7 8 9 10
<div class="widget widget-outer foo bar" id="my-widget">
<div class="widget-inner">
<div class="widget-hd" id="my-widget-hd">
<h2>My Widget</h2>
</div>
<div class="widget-bd" id="my-widget-bd">
<ul>
<li>one</li>
<li>two</li>
<li>three</li>
View indices.js
1 2 3 4 5 6 7 8
function indices(n) {
var a = [], i = 0;
a.length = n = n | 0;
for (; i < n; i++) {
a[i] = i;
}
return a;
}
View enqueue.js
1 2 3 4 5 6
// push items to the end of an array and shift array so that length is <= max.
// return any items that are removed, or null
function enqueue(array, max) {
var n = array.push.apply(array, Array.prototype.slice.call(arguments, 2)) - max;
return n > 0 ? array.splice(0, n) : null;
}
Something went wrong with that request. Please try again.