npm Basic Commands

I’m going to put in here npm commands that i use every day. It’s just for my reference and maybe it will useful for someone else.

– Install package globally

npm install -g <package_name>

– Listing installed global packages

npm list -g --depth=0

– Uninstall global package

npm uninstall -g <package_name>

– Search package

npm search <package_name>

– Update local package

cd /path/to/project && npm update


JavaScript Resources

Below is my list of sites that i’m using to learn more about JavaScript. If you have your resources, just post it in the comment section. Thanks!


Last week i spent my time reading about Microeconomics subject on I really love their design, i can tell they spent amount of time to test their user experience design.

One thing i like is how the page flows between each other. I noticed they are using AJAX to render part of the UI to keep the user in that page while maintaining the URL history. After looking at their source code, looks like they are using Backbone.js to structure their app also React.js and Handlebars for templating.

WordPress also using Backbone.js.

So much for Backbone.js that i decided to learn more about it tonight 🙂

Free open-source reading : Developing Backbone.js Application

Emulate get_called_class for PHP < 5.3

This snippet of code will emulate get_called_class function for PHP < 5.3. This will come handy if you want to use Singleton pattern using base abstract class.

if ( !function_exists('get_called_class') ) {
  function get_called_class() {
    $bt = debug_backtrace();
    $lines = file( $bt[1]['file'] );
      '/([a-zA-Z0-9\_]+)::' . $bt[1]['function'] . '/',
      $lines[ $bt[1]['line'] - 1 ],
    return $matches[1];

Reference :

Unable to install plugins that depend on nokogiri in Vagrant 1.6+

If you encounter this issue while performing vagrant plugin update or vagrant plugin install that require nokogiri

Bundler, the underlying system Vagrant uses to install plugins,
reported an error. The error is shown below. These errors are usually
caused by misconfigured plugin installations or transient network
issues. The error from Bundler is:

An error occurred while installing nokogiri (, and Bundler cannot continue.
Make sure that `gem install nokogiri -v ‘’` succeeds before bundling.

This solution works for me (OSX 10.9.3):

add s.add_dependency(%q, [“< 1.6.2”]) to /Applications/Vagrant/embedded/gems/specifications/vagrant-1.6.2.gemspec

For reference :