DO's:
- Use explicit contracts to pipe data & events between systems
- Business rules should bubble towards the top, UI and semantics should sink towards the bottom
DONT's:
| // this setup assumes you are using gulp-config for file.src & file.dest | |
| // but can be adapted to vanilla easily. | |
| 'use strict'; | |
| var transform = require('vinyl-transform'), | |
| browserify = require('browserify'), | |
| watchify = require('watchify'), | |
| // consider using gulp-load-plugins |
| var gulp = require('gulp'); | |
| var browserify = require('browserify'); | |
| var notify = require('gulp-notify'); | |
| var source = require('vinyl-source-stream'); | |
| var watchify = require('watchify'); | |
| var plumber = require('gulp-plumber'); | |
| var less = require('gulp-less'); | |
| var csso = require('gulp-csso'); | |
| var watch = require('gulp-watch'); | |
| var envify = require('envify'); |
| # mimic osx pbcopy/pbpaste | |
| alias pbcopy="xclip -selection clipboard -i" | |
| alias pbpaste="xclip -selection clipboard -o" |
| # | |
| # CORS header support | |
| # | |
| # One way to use this is by placing it into a file called "cors_support" | |
| # under your Nginx configuration directory and placing the following | |
| # statement inside your **location** block(s): | |
| # | |
| # include cors_support; | |
| # | |
| # As of Nginx 1.7.5, add_header supports an "always" parameter which |
| // USAGE ------ | |
| // ============ | |
| var shell = require('./shellHelper'); | |
| // execute a single shell command | |
| shell.exec('npm test --coverage', function(err){ | |
| console.log('executed test'); | |
| }}); |
This instructions allow you to take periodical heapdumps.
To use in your project, first install heapdump, then add the following code to your app just after requiring 'fs'.
| var fs = require('fs'); | |
| var lame = require('lame'); | |
| var Speaker = require('speaker'); | |
| fs.createReadStream(process.argv[2]) | |
| .pipe(new lame.Decoder()) | |
| .on('format', function (format) { | |
| this.pipe(new Speaker(format)); | |
| }); |