using mocha/chai/sinon for node.js unit-tests? check out my utility: mocha-stirrer to easily reuse test components and mock require dependencies
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
# This number should be, at maximum, the number of CPU cores on your system. | |
# (since nginx doesn't benefit from more than one worker per CPU.) | |
worker_processes 8; | |
# Determines how many clients will be served by each worker process. | |
# (Max clients = worker_connections * worker_processes) | |
# "Max clients" is also limited by the number of socket connections available on the system (~64k) | |
# run ss -s and u'll see a timewait param | |
# The reason for TIMED_WAIT is to handle the case of packets arriving after the socket is closed. |
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
/* app/controllers/index.js */ | |
module.exports.index = function(req, res) { | |
res.render('index.html'); | |
}; |
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
// FullParallel businessLogichronous engine | |
function fullParallel(callbacks, last) { | |
var results = []; | |
var result_count = 0; | |
callbacks.forEach(function(callback, index) { | |
callback( function() { | |
results[index] = Array.prototype.slice.call(arguments); |
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
function getSubdomain(h) { | |
var parts = h.split("."); | |
if(parts.length == 2) return "www"; | |
return parts[0]; | |
} | |
//later on... | |
exports.index = function(req, res) { | |
var subdomain = getSubdomain(req.headers.host); | |
res.render('index', { title: 'Express', subdomain:subdomain }); |
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 middleware = require('middleware'), // the Middleware you want to test | |
httpMocks = require('node-mocks-http'), // quickly sets up REQUEST and RESPONSE to be passed into Express Middleware | |
request = {}, // define REQUEST | |
response = {} // define RESPONSE | |
; | |
describe('Middleware test', function(){ | |
context('Valid arguments are passed', function() { | |
beforeEach(function(done) { | |
/* |
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
[ | |
"AzkabanCoders.dustjs", | |
"Dart-Code.dart-code", | |
"EditorConfig.EditorConfig", | |
"aaron-bond.better-comments", | |
"eriklynd.json-tools", | |
"gerane.Theme-Dark-Dracula", | |
"kumar-harsh.graphql-for-vscode", | |
"redhat.java", | |
"vscjava.vscode-java-debug", |
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
{ | |
"editor.rulers": [80,120], | |
"editor.tabSize": 2, | |
"explorer.autoReveal": false, | |
"explorer.enableDragAndDrop": false, | |
"explorer.openEditors.visible": 0, | |
"search.useIgnoreFiles": true, | |
"files.trimTrailingWhitespace": true, | |
"files.insertFinalNewline": true, | |
"files.exclude": { |
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
{ | |
"editor.tabSize": 2, | |
"explorer.autoReveal": false, | |
"explorer.enableDragAndDrop": false, | |
"files.exclude": { | |
"**/.git": true, | |
"**/.svn": true, | |
"**/.hg": true, | |
"**/CVS": true, | |
"**/.DS_Store": true, |