Skip to content

Instantly share code, notes, and snippets.

View paulogr's full-sized avatar
🏠
Working from home

Paulo paulogr

🏠
Working from home
  • São Paulo, Brazil
  • 12:57 (UTC -03:00)
View GitHub Profile
@paulogr
paulogr / ssr.js
Created September 28, 2017 12:22 — forked from mortenson/ssr.js
Flexible server side rendering script for Stencil when used in other platforms
// Put this file in a directory where @stencil/core exists in node_modules, then run:
// $ echo $HTML | node ssr.js [root] [build-dir] [namespace]
// Full example from my use case:
// $ echo '<sam-text text="Hello, world"></sam-text>' | node ssr.js /var/www/stencil/sams-components/dist ../ sam
// Pipes are used because HTML strings can be really long, and bash has limits on how large argument lists can get (~256k usually).
var stencil = require('@stencil/core');
var args = process.argv.slice(2);
if (args.length < 3) {
console.error('Not enough args');
}
@mortenson
mortenson / ssr.js
Last active October 8, 2017 15:17
Flexible server side rendering script for Stencil when used in other platforms
// Put this file in a directory where @stencil/core exists in node_modules, then run: +var stencil = require('@stencil/core/server');
// $ echo $HTML | node ssr.js [root] [build-dir] [namespace]
// Full example from my use case:
// $ echo '<sam-text text="Hello, world"></sam-text>' | node ssr.js /var/www/stencil/sams-components/ ../dist sam
// Pipes are used because HTML strings can be really long, and bash has limits on how large argument lists can get (~256k usually).
var stencil = require('@stencil/core/server');
var args = process.argv.slice(2);
if (args.length < 3) {
console.error('Not enough args');
}
@kfox
kfox / tcpproxy.js
Created April 5, 2012 20:03
A basic TCP proxy written in node.js
var net = require("net");
process.on("uncaughtException", function(error) {
console.error(error);
});
if (process.argv.length != 5) {
console.log("usage: %s <localport> <remotehost> <remoteport>", process.argv[1]);
process.exit();
}