Skip to content

Instantly share code, notes, and snippets.

m5m1th / devChallenge1.js
Created Dec 5, 2014
Dev Challenge! What are all the issues with this code? Hint: there are several.
View devChallenge1.js
var hyperquest = require('hyperquest');
var result;
module.exports = function downloadUtf8FileIntoString(url, cb) {
if (!url) return cb(Error('url is required'));
result = '';
.pipe(function (chunk, enc, tCb) {
result += chunk.toString('utf8'); // binary to utf8
m5m1th /
Last active May 27, 2020
Redirect port 3080/3443 to 80/443 for local dev
#Requests from outside
iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-ports 3080
iptables -t nat -A PREROUTING -p tcp --dport 443 -j REDIRECT --to-ports 3443
#Requests from localhost
iptables -t nat -I OUTPUT -p tcp -d --dport 80 -j REDIRECT --to-ports 3080
iptables -t nat -I OUTPUT -p tcp -d --dport 443 -j REDIRECT --to-ports 3443
m5m1th / runAll.js
Last active Dec 19, 2015
Simple script to run a bunch of projects at once (Windows requires grunt.cmd for some reason)
View runAll.js
var spawn = require('child_process').spawn;
spawn('node', ['app.js'], {stdio: 'inherit', cwd: 'gaviota-api/'});
spawn('node', ['app.js'], {stdio: 'inherit', cwd: 'gaviota-proxy/'});
spawn('node', ['app.js'], {stdio: 'inherit', cwd: 'gaviota-api-async/'});
spawn('node', ['app.js'], {stdio: 'inherit', cwd: 'mf-public-web/'});
spawn('grunt.cmd', ['server:fastcss'], {stdio: 'inherit', cwd: 'TrainerWeb/'});
spawn('sass.bat', ['--compass', '--watch', 'styles/main.scss:styles/main.css'], {stdio: 'inherit', cwd: 'TrainerWeb/app/Trainer/'});