Every friday we have interview prep. It's suppossed to be an optional gathering for the ones who want to seek a job after the Recurse Center. Last friday the exercise was to build a simple url-shortener in a few hours. Basically what you had to do was set up some user-friendly web application that did the job. I used Sinatra as my web framework and Bootstrap for css styling.

This is what my project ended up looking like:

Alt text ... Alt text

To use bootstrap, all you have to do is insert this line in your html's <head></head> divs:

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css>

Then, what the application does is it fetches the given URL, generates a random string (of length 6) and saves this mapping into a hash (dictionary). We didn't save this in a database (because of time restrictions). When someone accesses the shortened url, then the application gets the hash for the given string and redirects the user to it.

That's it. Pretty simple, han?

Ps. It's so nice to have the time to just work on whatever you want!