node-paperserve - Quick and dirty web server from your working directory

Install

$ npm install paperserve

Usage

paperserve [path-to-serve]

  -p, --port [PORT]  set the port to listen on, default 8000
  -q, --quiet        turn off any logging, default false
  -h, --help         display this help message

Here’s what the output looks like:

>>> paperserve: running on port 8000, serving from '/cygdrive/d/Workspace/public/node-paperserve'
>>> paperserve:   Press Ctrl-C to stop.

Source code can be found on GitHub. As for the motivation behind the project – let’s just say I prefer JavaScript to Python.

Cygwin, CoffeeScript & Growl for Windows integration

Let’s start by adjusting where node.js looks for libraries. We will need this later on when we use the newly implemented -r command-line switch in CoffeeScript. Open up your shell init file, in my instance ~/.zshrc:

$ vim ~/.zshrc

and add a line in there:

export NODE_PATH="/cygdrive/d/Workspace/public/coffee-script/.coffee_libraries:$NODE_PATH"

The path can be anywhere on your system so adjust it accordingly. Let’s go ahead and create a file inside .coffee_libraries, name it growlnotify-windows.coffee and paste this code inside of it:

We also need a proper icon – save it in the script folder as icon-coffee-cup.png.

Next time you run the coffee command line utility, append -r growlnotify-windows like so:

$ coffee -r growlnotify-windows -wc src/

and when the compiler encounters an exception, you will receive a nice UI prompt like this:

Smokestack theme preview

Happy coding!

Styling XUL applications like web pages

If you don’t know of XUL applications there are many out there in the wild. You are probably using a Mozilla XUL-based app without even realising it.

I am a Komodo Edit user myself and I love the platform. I have posted several extensions if my words are not enough to prove it.

The greatest weakness of XUL apps in my book is how static they feel. They are not as dynamic and rich as HTML documents and as a result development is usually not as easy and elegant. You are forced to restart the application between updates or rely on hacky methods to reload it while running. Being frustrated with these facts, I decided to do something about it. It would be wonderful if you could just press Ctrl+Alt+R and have a fresh stylesheet loaded into your application – much like existing solutions for Google Chrome of Firefox. Here is one way you can do just this in Komodo:

Create this as a macro and assign a key binding to it. Pressing it will discard any previously loaded stylesheet and inject a non-cached fresh copy of it right in the beginning of the document.

This can be simulated in any XUL app – you would need a keypress handler and some code to deal with recognising the correct combination of keys and you are off on a good start.

Get my Coffee, Compass and web server in the background, please

This is a simple bash script I run from my project’s working directory to get CoffeeScript, Compass and a simple web server running. Any changes to *.(coffee|scss) files will be compiled on the fly. Remember to check the console every now and then if you think you’ve made an whoopsy:

You need an empty compass.config.rb file to be present. Mine usually has some goodness in it:

images_dir      = 'static/images'
relative_assets = true

In need of a simple web server

I was hacking away on an AJAX application and needed to do some XMLHttpRequest goodness. Needless to say, working with the file:// protocol has become very restrictive lately so I was in a need of a simple web server - this meant no configuration, no support, no hassle whatsoever:

$ python -m SimpleHTTPServer &

and your working directory is now accessible over at http://localhost:8000/