Skip to content

Instantly share code, notes, and snippets.

View phizaz's full-sized avatar
😀

Konpat phizaz

😀
View GitHub Profile
$ brew info nvm
nvm: stable 0.29.0, HEAD
Manage multiple Node.js versions
https://github.com/creationix/nvm
Not installed
From: https://github.com/Homebrew/homebrew/blob/master/Library/Formula/nvm.rb
==> Caveats
Please note that upstream has asked us to make explicit managing
nvm via Homebrew is unsupported by them and you should check any
$ brew search nvm
convmv mvnvm nvm
$ brew install nvm
$ nvm
Node Version Manager
Usage:
nvm help Show this message
nvm --version Print out the latest released version of nvm
nvm install [-s] <version> Download and install a <version>, [-s] from source. Uses .nvmrc if available
nvm uninstall <version> Uninstall a version
nvm use <version> Modify PATH to use <version>. Uses .nvmrc if available
# never installed before
$ nvm install v4.2.1
# upgrading
$ nvm install v4.2.1 --reinstall-packages-from=<your_old_version>
$ nvm alias default 4.2.1
# install with global option because node.js has two kinds of package installs,
# one is 'global' everything in the computer can use the global packages
# another one is 'local' only the designated area can use the local packages
# here we want babel (as a system-wide program) can be used from anywhere
$ npm install --global babel
$ babel --version
5.8.29 (babel-core 5.8.29)
$ node --version
v4.2.1
$ npm --version
3.3.10
@phizaz
phizaz / worker.py
Last active June 15, 2016 15:19
A single worker with queue and promise pattern (inspiration from Javascript)
from Queue import Queue
from threading import Thread
'''
A single worker with queue and promise pattern
usage: worker.add_job(fn).then(callback_fn)
note: this might be anti-pattern
'''