Skip to content

Instantly share code, notes, and snippets.

View Unitech's full-sized avatar

Alexandre Strzelewicz Unitech

View GitHub Profile
@-webkit-keyframes bgcolor { 0% { background-color: #ffccf2; }
50% { background-color: #ccffcc; }
100% { background-color: #ccffff; } }
@-moz-keyframes bgcolor { 0% { background-color: #ffccf2; }
50% { background-color: #ccffcc; }
100% { background-color: #ccffff; } }
@-ms-keyframes bgcolor { 0% { background-color: #ffccf2; }
50% { background-color: #ccffcc; }
@Unitech
Unitech / pm2 deploy
Created June 11, 2014 10:32
pm2 deploy
{
apps : [{
"name" : "api",
"script" : "./app1/api.js",
"instances" : "4"
},{
"name" : "dev-api",
"script" : "./app2/child.js",
"instances" : "1"
}],
@Unitech
Unitech / nginx.conf
Created June 14, 2014 12:35
/etc/init/nginx.conf
# nginx
description "nginx http daemon"
author "George Shammas <[email protected]>"
start on (filesystem and net-device-up IFACE=lo)
stop on runlevel [!2345]
env DAEMON=/usr/bin/nginx
env PID=/usr/local/nginx/logs/nginx.pid
@Unitech
Unitech / nginx.conf
Created June 20, 2014 10:37
nginx.conf
#user nobody;
worker_processes auto;
events {
worker_connections 1024;
}
http {
include mime.types;
@Unitech
Unitech / Gruntfile.js
Created July 5, 2014 15:09
List grunt task and exec
var grunt = require('grunt');
var gruntfile = require('./Gruntfile.js')(grunt);
var tasks = grunt.task._tasks;
var tasks_array = [];
for (var task in tasks) {
if (tasks.hasOwnProperty(task)) {
console.log(tasks[task].name);
app.all('*', function (req, res, next) {
res.header("Access-Control-Allow-Origin", req.headers.origin);
res.header("Access-Control-Allow-Credentials", true);
res.header('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE,OPTIONS');
res.header("Access-Control-Allow-Headers", "X-Requested-With, Content-Type, Authorization, Content-Length");
if (req.method == 'OPTIONS') {
return res.send(200);
}
@Unitech
Unitech / line.js
Last active August 29, 2015 14:04
Log for Node with filename + line
Object.defineProperty(global, '__stack', {
get: function(){
var orig = Error.prepareStackTrace;
Error.prepareStackTrace = function(_, stack){ return stack; };
var err = new Error;
Error.captureStackTrace(err, arguments.callee);
var stack = err.stack;
Error.prepareStackTrace = orig;
return stack;
}
@Unitech
Unitech / http-wrapper.js
Last active March 16, 2016 07:41
Print user agent & co
var Proxy = require('./proxy.js');
var HttpWrap = module.exports = function(http) {
Proxy.wrap(http.Server.prototype, ['on', 'addListener'], function(addListener) {
return function(event, listener) {
if (!(event === 'request' && typeof listener === 'function')) return addListener.apply(this, arguments);
return addListener.call(this, event, function(request, response) {
var self = this;
Entering in node wrap logic (cluster_mode) for script /root/pm2/examples/kill-not-so-fast.js
Debug port must be in range 1024 to 65535.
Usage: node [options] [ -e script | script.js ] [arguments]
node debug script.js [arguments]
Options:
-v, --version print node's version
-e, --eval script evaluate script
-p, --print evaluate script and print result
-i, --interactive always enter the REPL even if stdin
git clone https://github.com/Unitech/PM2.git
cd PM2
npm install
npm test