Save and run as sort.js with a list of integers as arguments
node sort.js 1 3 2 9 3 22
output
[ 1, 2, 3, 3, 9, 22 ]
Save and run as sort.js with a list of integers as arguments
node sort.js 1 3 2 9 3 22
output
[ 1, 2, 3, 3, 9, 22 ]
var models = require('./models');
var utils = require('./utils');
var config = require('./config');
models.Order.find({}, function(err, results) {
console.log('models.Order.find type of datetime',results[0].attributes.datetime);
console.log('type of datetime', typeof results[0].attributes.datetime);
});
Tables
Table restaurants
Column | Type
-----------------------+--------------------------
id | integer
Table contacts
Column | Type
Declare actions.js
var scheduler = require('../lib/scheduler');
scheduler.registerAction('make-call', function(job, done) {
twilio.makeCall(job.data, function(error) {
if (error) {
logger.error('Could not place call for job #' + job.id, error);
done('failed');
} else {| // Step 1: npm install heapdump | |
| // Step 2: Paste this snippet in your main | |
| // app to create heap snapshots that you | |
| // can view in the chrome profiler | |
| require('heapdump'); | |
| setInterval(function() { | |
| process.kill(process.pid, 'SIGUSR2'); | |
| }, 15000); |
| -webkit-font-smoothing: antialiased; | |
| -moz-osx-font-smoothing: grayscale; | |
| text-rendering: optimizeLegibility; | |
| line-height: 1.5em; |
| // monkey patches dirac with ./plugins folder | |
| var dirac = require('dirac'); | |
| modules.exports = function(options) { | |
| options = options || {}; | |
| // plugins folder contains table folders, each containing plugin definitions | |
| fs.readDir(options.path || './plugins'); | |
| // pseudocode |
To perform transactions use the dirac.tx api. Dirac defaults to
using client pooling per request. So a single client must be used
over the lifespan of a transaction. The tx will fetch one for you
and release it upon .commit().
A dirac tx object has access to the same DALs in addition to transactional commands.