npm login
npm publish
npm dist-tag add [email protected] mongoose
npm login
npm publish
npm dist-tag add [email protected] mongoose
# https://github.com/angular-ui/ui-router/wiki/Frequently-Asked-Questions#how-to-configure-your-server-to-work-with-html5mode | |
<VirtualHost *:80> | |
ServerName my-app | |
DocumentRoot /path/to/app | |
<Directory /path/to/app> | |
RewriteEngine on | |
# Don't rewrite files or directories |
# https://github.com/socketio/socket.io/issues/1942#issuecomment-204335448 | |
ProxyPass / http://localhost:3999/ | |
ProxyPassReverse / http://localhost:3999/ | |
RewriteEngine on | |
RewriteCond %{HTTP:UPGRADE} ^WebSocket$ [NC] | |
RewriteCond %{HTTP:CONNECTION} ^Upgrade$ [NC] | |
RewriteRule .* ws://localhost:3999%{REQUEST_URI} [P] |
// http://stackoverflow.com/questions/37339479/express-validator-to-validate-paramenter-which-is-an-array#answer-37342458 | |
var expressValidator = require('express-validator'); | |
var validator = require('validator'); | |
app.use(expressValidator({ | |
customValidators: { | |
isArray: function(value) { | |
return Array.isArray(value); | |
}, | |
notEmpty: function(array) { |
# upgrade nginx | |
sudo add-apt-repository ppa:nginx/stable | |
sudo apt-get update | |
sudo apt-get install nginx | |
# cache | |
proxy_cache_path /path/to/cache levels=1:2 keys_zone=my_cache:10m max_size=10g | |
inactive=60m use_temp_path=off; | |
server { |
# 10 biggest files | |
sudo du -a /var | sort -n -r | head -n 10 | |
# check available space | |
df -h | |
# check biggest folders/directories in GB | |
du -hsx * | sort -rh | head -10 | |
# create user and assign password |
#!/usr/bin/env bash | |
#install pm2 | |
npm i pm2 | |
#run with process.json configuration file for development environment | |
pm2 start process.json --env development | |
# delete it all | |
# pm2 delete process.json |
# Install JRE & JDK | |
sudo apt-get install openjdk-7-jre | |
sudo apt-get install openjdk-7-jdk | |
# Download the security key for the Jenkins repository | |
wget -q -O - https://jenkins-ci.org/debian/jenkins-ci.org.key | sudo apt-key add - | |
# Add the key to the trusted keys for apt-get | |
sudo sh -c 'echo deb http://pkg.jenkins-ci.org/debian binary/ > /etc/apt/sources.list.d/jenkins.list' |
[alias] | |
s = status | |
st = status --short --branch | |
b = branch | |
c = checkout | |
cb = "git checkout -b" | |
d = diff | |
ll = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --numstat | |
ld = log --pretty=format:"%C(yellow)%h\\ %C(green)%ad%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --date=short --graph | |
ls = log --pretty=format:"%C(green)%h\\ %C(yellow)[%ad]%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --date=relative |
/** | |
* mongodb cheat sheet | |
*/ | |
// create db | |
use tasks | |
// list dbs | |
show dbs |