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 timeZoneService = (function () { | |
var instance; | |
function init() { | |
var prop | |
var method = function() { | |
} | |
return { | |
prop:prop, | |
method:method |
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'); | |
aws.config.update({ | |
accessKeyId: 'YOUR_ACCESS_KEY', | |
secretAccessKey: 'YOUR_SECRET_KEY', | |
region: 'us-west-2' | |
}); | |
var ec2 = new aws.EC2(); |
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 stringify = function(obj, prop) { | |
var placeholder = '____PLACEHOLDER____'; | |
var fns = []; | |
var json = JSON.stringify(obj, function(key, value) { | |
if (typeof value === 'function') { | |
fns.push(value); | |
return placeholder; | |
} | |
return value; | |
}, 2); |
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 isoCountries = { | |
'AF' : 'Afghanistan', | |
'AX' : 'Aland Islands', | |
'AL' : 'Albania', | |
'DZ' : 'Algeria', | |
'AS' : 'American Samoa', | |
'AD' : 'Andorra', | |
'AO' : 'Angola', | |
'AI' : 'Anguilla', | |
'AQ' : 'Antarctica', |
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
//Following Code in boot | |
module.exports = function (app) { | |
// | |
//Loopback 3.0 don't support app.remotes().before | |
// | |
app.remotes().before('*.*', function(ctx,next1,next2) { | |
//console.log(ctx.req.headers) | |
//console.log('IP-1') | |
var context = LoopBackContext.getCurrentContext(); |
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
/** | |
* Based on @ericprieto code https://github.com/strongloop/loopback/issues/651#issuecomment-140879983 | |
* place this file into common/mixins/disableAllMethods.js | |
* | |
**/ | |
module.exports = function(Model, options) { | |
if(Model && Model.sharedClass) { | |
var methodsToExpose = options.expose || []; |
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
{ | |
"coRoutine": { | |
"prefix": "coBody", | |
"body": [ | |
"co(function*() {", | |
" cb(null,'ToDo');", | |
"})", | |
".catch(function(err){", | |
" cb(null,{err:err});", | |
"})" |
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 lines = fs.readFileSync(path.join(__dirname, '../actionData/'+fileName)).toString().split('\r\n'); | |
var rawData = []; | |
lines.map(function(line) { | |
rawData.push(line.split(',')) | |
}) |
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 _ = require('lodash'); | |
var fs = require("fs"); | |
var path = require('path'); | |
var DataGenerator = (function () { | |
var instance; | |
var lines = fs.readFileSync(path.join(__dirname, '../actionData/alice.txt')).toString().split('\n'); | |
lines = lines.filter(function(line) { | |
return (line.length > 0) | |
}) | |
function init() { |
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 redisServer = require('redis'); | |
var RedisService = (function () { | |
var instance; | |
function init() { | |
//6381 for Develop and Test | |
//6379 for Production | |
var port = 6379; | |
var host = "localhost"; | |
var redis = redisServer.createClient(port,host); |