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!

Experiencing khanacademy.org

Last week i spent my time reading about Microeconomics subject on khanacademy.org. 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'] );
    preg_match(
      '/([a-zA-Z0-9\_]+)::' . $bt[1]['function'] . '/',
      $lines[ $bt[1]['line'] - 1 ],
      $matches
    );
    return $matches[1];
  }
}

Reference : http://stackoverflow.com/questions/7902586/extend-a-singleton-with-php-5-2-x