I Did It My Way is a blog that started as a New Year's Resolution to learn Sinatra by completing practical projects. It also includes news & information about Sinatra as well as code examples.

CoffeeScript In Sinatra

CoffeeScript Logo

In case you haven’t heard, CoffeeScriptis an awesome little language that compiles into JavaScript. It basically makes JavaScript nice (and a lot more like Ruby).

Continue reading »

Writing For Ruby Source

Aug 04

A couple of weeks ago, Aaron Osteraas asked me to write some stuff for the Ruby Source website. I’ve written a couple of posts over the last week and the first one was published today! It’s called 7 Things I Love About Sinatra, I hope you’ll pop over, have a read and maybe leave a comment.

Continue reading »

Current Pages

Jul 18

Hi everybody. Sorry for the inactivity recently - I haven’t had chance to use Sinatra much at all, but that should change over the summer, happy days!

Here’s a quick piece of code that can often prove to be useful. When you’re producing websites or apps, you often need to know if a link is pointing to the current page or not. The main use for this is in a navigation menu - the current page is often styled differently. You can see a nice example of this on Google’s new homepage - the black nav bar at the top has some links, but the current page has an orange border on top.

Continue reading »

Cards in the Cloud

I’ve just finished my first full Sinatra project to go live and thought I’d share it with my fellow Crooners.

A Flying Duck

Cards in the Cloud is a web app that lets you send e-cards without all the usual fluff associated with those kind of sites (like tacky music, annoying animations and loads of intrusive adverts). I decided to build the site to scratch my own itch because I could never find a site that would just let me send cards without trying to spam me or get me to sign up for something.

Continue reading »

Sinatra Gets Slim

Mar 28

Sinatra 1.2 was released a few weeks ago and you can see the full list of all the shiny new additions here.


The thing that got me most excited was a new rendering engine called Slim. This is very similar to Haml that I wrote about a while back, but is even more simple and elegant looking.

Continue reading »

Rack Flash

The Flash

Rails has a nice little hash called the Flash - it’s not a Super Hero that can run fast, just a neat way temporarily storing messages to inbetween requests. For example if something happens in your app (a note is saved for example) and then you redirect the user to another page then you could store a message in the flash saying that the note had been saved. This message would then be shown on the next page (after the redirect).

Continue reading »

Ajax in Sinatra

Ajax has been around for a while now but that doesn’t mean it is any less fun. The nice thing about Sinatra is you are left to do as much or little JavaScript as you like and you can do it in any way that you want as well. In this ditty I hope to show that it’s easy to add some Ajax magic to a Sinatra app (with a little help from a JavaScript framework).

Continue reading »

Really Simple Authentication in Sinatra

One of the biggest requests from people is a post about authentication. There are loads of gems that help to do this, but I like to roll my own. Here’s a really simple way of creating an admin section of a website.

Continue reading »

Uploading Files In Sinatra

Please note that there are some problems with the code in this example - particularly the part about uploading a file to Heroku. You might still get something out of the post (and there are a lot of helpful comments) but please bear in mind that it might not work exactly how it should. I plan to write an updated guide soon that will hopefully work much better

Continue reading »

Another New Year!

Jan 05

Happy New Year!

It was a year ago that I started this site as a New Year’s Resolution and I’ve had a brilliant time.

I didn’t quite manage to produce a project every couple of months like I originally intended, but I did learn A LOT about Sinatra and loved every minute of it. I’m more convinced than ever Sinatra is the best tool for web development. Over the last year I’ve learnt about lots of new things and managed to blog about them as much as possible, but I’m disappointed that I haven’t been able to produce more full tutorials and will try to do more over the next year.

Continue reading »
Older Posts....