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 couchbase = require("couchbase"); | |
var cluster = new couchbase.Cluster("127.0.0.1:8091"); | |
var CbBucket = "aBucket"; | |
var pass = "12345678"; | |
var bucket = db.openBucket(CbBucket, password, function(err) { | |
bucket.operationTimeout = 500 * 1000; //increase connection time | |
if(err){ | |
throw 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 uuid = require('uuid'); | |
var couchbase = require("couchbase"); | |
var cluster = new couchbase.Cluster("127.0.0.1:8091"); | |
var CbBucket = "aBucket"; | |
var pass = "12345678"; | |
//get | |
var bucket = cluster.openBucket(CbBucket, pass, function(err) { | |
if (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
const Router = require('express').Router; | |
const router = new Router(); | |
const Lob = require('lob')('test_3168a75ff1d5412e93168ff1de3747a1523'); //"lob": "^3.5.0", | |
const async = require('async'); | |
router.post('/post-card', function(req, res){ | |
const users = req.body.users; | |
async.mapLimit(users, 5, function(user, callback) { | |
var to = { | |
name: user.name, |
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
const Router = require('express').Router; | |
const router = new Router(); | |
const client = require('twilio')('xxxxxxx', 'xxxxx'); | |
router.post('/send-sms', function(req, res){ | |
var users = req.body.users | |
var smsBody = req.body.smsBody; | |
async.each(users, function(user, callback) { | |
client.sendMessage({ |
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 fs = require('fs'); | |
var express = require('express'); | |
var multer = require('multer'); | |
var csv = require('fast-csv'); | |
var router = express.Router(); | |
var upload = multer({dest: 'tmp/csv/'}); | |
router.post('/upload', upload.single('file'), function (req, res, next) { |
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
const mandrill = require('mandrill-api/mandrill'); | |
const config = require('./config'); | |
const mandrill_client = new mandrill.Mandrill(config.mandrill.apiKey); | |
const mandrill_client_test = new mandrill.Mandrill(config.mandrill.testApiKey); // test client to emulate email sending | |
// some data | |
const noOftasks = 12; | |
const perfomance = "improved"; | |
const name = "Talha Awan"; |
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
const fs = require('fs'); | |
const json2csv = require('json2csv'); //"json2csv": "^3.7.3" | |
const moment = require('moment'); //"moment": "^2.17.1" | |
const mkdirp = require('mkdirp'); //"mkdirp": "^0.5.1", | |
const del = require('del'); //"del": "^2.2.2" | |
const fields = ['collection', 'message', 'createdAt']; | |
const Log = require ( './log.model'); | |
const Controller = {}; |
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 rets = require('rets-client'); | |
var async = require('async'); | |
var moment = require('moment'); | |
var clientSettings = { | |
loginUrl: 'http://maxebrdi.rets.paragonrels.com/rets/fnisrets.aspx/MAXEBRDI/login?rets-version=rets/1.7.2', | |
username: "XXXXXXXXXXX", | |
password: "XXXXXXXXXXX", | |
version: 'RETS/1.7.2', | |
userAgent: 'RETS node-client/4.x', |
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 async = require("async"); | |
var moment = require('moment'); | |
var User = require('/path/to/user.js'); | |
module.exports = function(){ | |
var skip = 0; | |
var limit = 700; //to process the users in batches of 700 | |
var newUsersFound = true; | |
var userCount = 0; | |
async.whilst( |
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
const CronJob = require('cron').CronJob; | |
const moment = require('moment-timezone'); | |
const cronJobs = [ | |
{ | |
cronTime: "*/20 * * * * *", | |
job: function (){ | |
console.log("Twenty seconds job has run"); | |
} | |
}, |