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
// execute a single shell command where "cmd" is a string | |
exports.exec = function(cmd, cb){ | |
// this would be way easier on a shell/bash script :P | |
var child_process = require('child_process'); | |
var parts = cmd.split(/\s+/g); | |
var p = child_process.spawn(parts[0], parts.slice(1), {stdio: 'inherit'}); | |
p.on('exit', function(code){ | |
var err = null; | |
if (code) { | |
err = new Error('command "'+ cmd +'" exited with wrong status code "'+ code +'"'); |
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 shell = require('./shell'); | |
// execute a single shell command | |
shell.exec('npm test --coverage', function(err){ | |
console.log('executed test'); | |
}}); | |
// execute multiple commands in series | |
shell.series([ |
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
/* | |
# CustomAsync | |
CustomAsync | |
## Examples | |
```js | |
var CAsync = require('custom-async'); | |
var async = new CAsync(); | |
async.sequence([ |
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
/* | |
// config Setting | |
"logging": [ | |
{ | |
"level": "verbose", | |
"type": "Console", | |
"colorize": true, | |
"timestamp": true | |
}, | |
{ |
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
#!/bin/bash | |
## INITIAL VARIABLES ## | |
# DYNAMIC VAR | |
HOSTNAME="" | |
USERNAME="" | |
PASSWORD="" | |
# STATIC VAR eS3szhxwj |
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 mysql = require('mysql'); | |
var inherits = require('util').inherits; | |
var EventEmitter = require('events').EventEmitter; | |
module.exports = MySql; | |
function MySql(config) { | |
var clusterConfig = { | |
removeNodeErrorCount: 1, // Remove the node immediately when connection fails. | |
defaultSelector: 'RR', |
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').MongoClient; | |
var DB = require('mongodb').Db; | |
var Server = require('mongodb').Server; | |
var async = require('async'); | |
var inherits = require('util').inherits; | |
var EventEmitter = require('events').EventEmitter; | |
var _ = require('underscore'); | |
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 mqtt = require('mqtt'); | |
var EventEmitter = require('events').EventEmitter; | |
var inherits = require('util').inherits; | |
module.exports = MqttProvider; | |
function MqttProvider( pushSetting ) { | |
var self = this; | |
self._initPushConnection(pushSetting); | |
}; |
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
'use strict'; | |
var gcm = require('node-gcm'); | |
var EventEmitter = require('events').EventEmitter; | |
var inherits = require('util').inherits; | |
module.exports = GcmProvider; | |
function GcmProvider( pushSettings ) { | |
this._initPushConnection(pushSettings.gcm); | |
}; |
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
'use strict'; | |
var EventEmitter = require('events').EventEmitter; | |
var inherits = require('util').inherits; | |
var apn = require('apn'); | |
module.exports = ApnsProvider; | |
function ApnsProvider( pushSettings ) { | |
var settings = pushSettings || {}; | |
var pushOptions = settings.pushOptions || {}; |
OlderNewer