Skip to content

Instantly share code, notes, and snippets.

View thuongdinh-agilityio's full-sized avatar
🎯
Focusing

Thuong Dinh thuongdinh-agilityio

🎯
Focusing
View GitHub Profile
@thuongdinh-agilityio
thuongdinh-agilityio / install_docker-compose.sh
Last active December 9, 2015 15:00
bash_installation_scripts_ubuntu
sudo apt-get install python-pip -y
sudo pip install -U docker-compose==1.4.0
@thuongdinh-agilityio
thuongdinh-agilityio / postgresql_create_database_grant_user.sh
Last active December 9, 2015 15:01
postgresql_create_database_grant_user
sudo -u postgres psql -tAc "CREATE DATABASE jerry;"
sudo -u postgres psql -tAc "GRANT ALL PRIVILEGES ON DATABASE jerry to tom;"
# This shows the setup for two services, an accounts service which connects to a database and a pagerduty service which connects to the pagerduty api
# Directory structure
accounts/
|_ Dockerfile
pagerduty/
|_ Dockerfile
nginx/
|_ conf/
|_ sites.conf
|_ .htpasswd

Better local require() paths for Node.js

Problem

When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:

var Article = require('../../../models/article');

Those suck for maintenance and they're ugly.

Possible solutions