I've been doing a lot of tinkering recently with various HTML/CSS snippets, such as working on a grid-based layout using semantic.gs.
When working with simple HTML/CSS and JavaScript, it'd be nice to be able to fire-up a very minimal, short-lived web server for the purpose of sandboxing with the code at hand.
I came up with* a straight-forward solution. You will need to have node.js installed on your machine, as well as the connect middleware (the latter can be installed simply by running npm install connect in a terminal session).
Once you have these two dependencies installed, you can then just copy and paste this snippet of JavaScript into a file, say server.js, which should then be placed into the directory in which your root HTML file is located:
var util = require('util'),
connect = require('connect'),
port = 1337;
connect.createServer(connect.static(__dirname)).listen(port);
util.puts('Listening on ' + port + '...');
util.puts('Press Ctrl + C to stop.');
Then just fire up a terminal/command prompt session and run node server.js. You'll now be able to access your HTML files, etc. via http://localhost:1337/my-example-file.html.
* NB: I am aware that I'm almost certainly not the first to think of this. This blog post serves mainly as a reference for me in the future!