Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Ruben Deyhle deyhle

🎯
Focusing
View GitHub Profile
@malko
malko / makeTemplate.js
Created Mar 21, 2017
dynamic es6 template string to template methods
View makeTemplate.js
//const tpl = makeTemplate('hello ${name}')
//const name = 'world';
//tpl({name});
const makeTemplate = (templateString) => {
return (templateData) => new Function(`{${Object.keys(templateData).join(',')}}`, 'return `' + templateString + '`')(templateData);
}
@jdxcode
jdxcode / boot.js
Last active Oct 24, 2018
zero-downtime node.js app runner
View boot.js
// This script will boot app.js with the number of workers
// specified in WORKER_COUNT.
//
// The master will respond to SIGHUP, which will trigger
// restarting all the workers and reloading the app.
var cluster = require('cluster');
var workerCount = process.env.WORKER_COUNT || 2;
// Defines what each worker needs to run
You can’t perform that action at this time.