Serve a Directory with Ruby

By  on  

Quickly serving a directory using PHP, Node.js, or Python allows for quick testing with as little hassle as possible.  Imagine having to stand up apache or another server just to serve a directory -- gross!  Since I had touched the three important languages, I looked to Ruby, a language I have very little experience with.

It turns out that serving a directory with Ruby is as easy as the other languages:

ruby -run -e httpd . -p 8080

The -p argument obviously represents the port, so hitting localhost:8080 will get you to the served directory!

Recent Features

Incredible Demos

  • By
    HTML5’s window.postMessage API

    One of the little known HTML5 APIs is the window.postMessage API.  window.postMessage allows for sending data messages between two windows/frames across domains.  Essentially window.postMessage acts as cross-domain AJAX without the server shims. Let's take a look at how window.postMessage works and how you...

  • By
    Image Reflection with jQuery and MooTools

    One subtle detail that can make a big difference on any web design is the use of image reflections. Using them too often can become obnoxious but using reflections on large, "masthead" images is a classy enhancement. Unfortunately creating image reflections within your...

Discussion

    Wrap your code in <pre class="{language}"></pre> tags, link to a GitHub gist, JSFiddle fiddle, or CodePen pen to embed!