This file contains hidden or 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 inherits = require('utils').inherits | |
| var Model = require('some-orm').Model | |
| function User () { | |
| Model.call(this) | |
| } | |
| inherits(User, Model) | |
| Model.prototype.getName () { |
This file contains hidden or 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 promisify = require("es6-promisify"); // you can also look for a promisifyAll equivalent, but for the sake of demonstration | |
| function findText(freeText, result) { | |
| var query = { | |
| index: result.teamUnique + "_team", | |
| type: result.username, | |
| body: { | |
| query: { | |
| match: { | |
| name: freeText |
This file contains hidden or 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
| criterion.forEach(function(item) { | |
| item.maprange = item.startmap + " "; | |
| if (item.endmap != null && item.startmap !== item.endmap) { | |
| item.maprange += " - " + item.endmap; | |
| } | |
| }) |
This file contains hidden or 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 Promise = require("bluebird"); | |
| function promisifyWaterline(action){ | |
| return Promise.try(function() { | |
| return action(); | |
| }).catch(function(err) { | |
| // you should almost never catch errors inline. ONLY do it if you need to 'repackage' an error. | |
| // definitely don't do the below, as you lose the original error. | |
| throw new Error("lol"); | |
| }) |
This file contains hidden or 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
| return new Promise((resolve, reject) => { | |
| var currentDate = moment().format(); | |
| var dates = []; | |
| for (var i = 1; i < days + 1; i++) { | |
| dates.push(moment().subtract(i, "days")); | |
| } | |
| resolve(dates); |
This file contains hidden or 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
| passport.use(new LocalStrategy( | |
| function(username, password, done) { | |
| collections.UserCollection.forge() | |
| .query(function (qb) { | |
| qb.where('username', '=', username.toLowerCase()); | |
| }) | |
| .fetchOne() | |
| .then(function (user) { | |
| if (user == null) { |
This file contains hidden or 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 Promise = require("bluebird"); | |
| var bhttp = Promise.promisifyAll(require("bhttp")); | |
| // config encapsulates opensensors-api-key | |
| // the only key config should have is "api-key" | |
| module.exports = function(config) { | |
| var API_BASE_URL = "https://api.opensensors.io/v1/"; | |
| var API_OPTIONS = { | |
| headers: { | |
| Accept: "application/json", |
This file contains hidden or 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
| 'use strict'; | |
| var _ = require('lodash'); | |
| var async = require('async'); | |
| var moment = require('moment'); | |
| var Promise = require('bluebird'); | |
| var messaging = require('../../messaging'); | |
| var patients = require('../patients'); | |
| var practitioners = require('../practitioners'); | |
| var dataProvider = require('../../database'); |
This file contains hidden or 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 aws = require('aws-sdk'), | |
| Promise = require('bluebird'), | |
| chalk = require('chalk'), | |
| messageFactory = require('./factory'), | |
| config = require('./config.json'); | |
| var sqs = new Promise.promisifyAll(new aws.SQS({ | |
| region: config.aws.region, | |
| accessKeyId: config.aws.accessId, |
This file contains hidden or 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
| AuctionController.getAll = function() { | |
| return collections.AuctionCollection.forge().fetch(); | |
| }; |