buck.ly is a bit.ly clone, written in Brubeck and sorta paying homage to Jeff Buckley.
It looks like this:
Enter a URL, hit save, and you'll be greeted with a short URL that will expand to the original, and increment a count on how many times it's been dereferenced.
If you enter that URL in your browser, you'll be redirected to the URL.
The url shortening code is based works by counting up from 0 and simply converts from that count to base 52. Normally, base 62 is a good choice, but I removed the vowels to prevent accidentally creating curse words in short urls.
The base conversion code is from this snippet: http://code.activestate.com/recipes/111286/
There is a LinkExpansionHandler
that will take a short URL code and send an
HTTP 302 to redirect a browser to the expanded URL.
There is also a very simple API. It just implements HTTP GET and returns the expanded URL.
Check out the Todos project for a better experience building APIs. Uses backbone.js too!