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 MAX_ZOOM = 21; | |
var OFFSET = 268435456; | |
var RADIUS = 85445659.4471; | |
var latToY = function(value) { | |
return Math.round(OFFSET - RADIUS * Math.log((1 + Math.sin(value * Math.PI / 180)) / (1 - Math.sin(value * Math.PI / 180))) / 2); | |
}; | |
var lngToX = function(value) { | |
return Math.round(OFFSET + RADIUS * value * Math.PI / 180); |
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 map = function() { | |
var completions = this.statistics.completions.total; | |
emit(key, { | |
created: { | |
count: 1, | |
length: this.length | |
}, | |
completed: { | |
count: completions, |
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 clusters = []; | |
while (walks.length > 0) { | |
var walk = walks.pop(); | |
var point = walk.startPoint; | |
var count = 0; | |
var lat = 0; | |
var lng = 0; | |
for (var i = walks.length - 1; i >= 0; i--) { |
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 getStructure = function(req, res, next) { | |
db.findOne({name: req.params.name}, function(err, result) { | |
res.json(result); | |
}); | |
} | |
app.get('/structure/:name', getStructure); | |
app.post('/structure/:name/save', function(req, res, next) { | |
var structure = req.body; |
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 routes = require('./routes'); | |
var configure = exports.configure = function(app, callback) { | |
app.use(express.bodyParser()); | |
app.use(app.router); | |
app.use(function(err, req, res, next) { | |
res.json({error: err.message}, 500); | |
}); | |
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
{{#sites}} | |
<table class="common-table"> | |
<thead> | |
<tr> | |
<th>Site name</th> | |
<th colspan="2">Store name</th> | |
</tr> | |
</thead> | |
<tbody> | |
{{#sites}} |
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
app.use(express.bodyParser()); | |
app.use(express.cookieParser()); | |
app.use(express.session({secret: 'x'})); | |
app.use(express.static(__dirname + '/public')); | |
app.use(express.errorHandler({ dumpExceptions: true, showStack: true })); | |
app.use(app.router); | |
app.use(function(req, res, next) { | |
if (req.session.user) { | |
next(); |
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
app.use(app.router); | |
app.use(function(err, req, res, next) { | |
res.json({error: err.message}, 500); | |
}); | |
app.get(...) |
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
app.requireSecureConnection = function(req, res, next) { | |
var err; | |
if (req.connection.encrypted === null) { | |
err = new Error('Access denied.'); | |
} | |
next(err); | |
}; |
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 mongodb = require('mongodb'), | |
events = require('events'), | |
util = require('util'); | |
var Deferrer = function(emitter, timeoutDelay) { | |
var self = this; | |
var pending = 0; | |
var total = 0; | |
var timeout; |
OlderNewer