So there I was, done with finals, a fresh Mocha, a large piece of coffee cake
and a quiet café with a fast wireless internet connection. What should I do?
Ah ha! Code!

I have, for a while, been looking for a good place to store my thoughts. I
didn't need a to-do list, because most of the stuff I write down is more of a
"wouldn't this be cool" instead of a "you need to do this in the next two

A long time ago I had started a little PHP app called theStack to do just this.
I sadly though abandoned it due to time constraints. On this day with nothing
but free time, I decided to code it up. I took a quick look at the PHP, and
said, "the hell with this, I'm going to be trendy and code this in ruby."

The first thing I needed was to figure out how to code ruby for the web. I had
heard rails was awesome, but I also heard that it had a ton of overhead. Then I
remembered Sinatra. Sinatra is a nice, small, and easy web framework that
is really easy to learn. I read through the readme and started coding.

The readme is misleading. One thing it does not mention is that all of its code
is for Sinatra >= 1.0, which, until recently, the ruby gem did not install by
default. Also, since I had planned on deploying this to Heroku, I needed to
figure out how to get Heroku using the correct version of Sinatra (Heroku, by
default, uses 0.9.4).

To install the correct version of Sinatra on your local machine is quite easy
now that 1.0 has been released, but if for some reason you are trying to get
the delopment build instead of the stable build, you can add --pre to the gem

gem install --pre sinatra

The main two things that 1.0 support adds, is support for less and erubis.


My friend Reed introduced me to less a little while ago. It's very
similar to CSS, but allows for you to nest things, and save information into
variables, which is pretty awesome, and generally makes CSS files easier to
read and code.


Since I started writting this article, I've actually given up on erubis.
It's meant to be a fast version of ERB, but it has a decent amount of bugs
in it, so I switched to plain ERB, and have been loving every minute of

Gems on Heroku

To get gems (such as Sinatra and less) on Heroku, you need a .gems file in your
git repository. I have provided an example, but it is pretty straight forward.

sinatra --version 1.0


I think I'll save this for a sperate article, but you can see the code I am
writing on GitHub.


Deploying to Heroku is pretty easy. You can use two methods, either a Rakefile,
or just from the straight command line.

First you need to create an account on and then follow their
quickstart guide. But the general overview is pretty simple. First
gem install heroku then run heroku create in your directory. Finally run
git push heroku master. Now your app is running on heroku! Also before you
start, you need to have a git repository for your project, which I assume you
know how to do.

You can also add the following to your Rakefile, so you would type
rake deploy instead of git push heroku master.

desc "Deploy to Heroku."
task :deploy do
   require 'heroku'
   require 'heroku/command'
   user, pass ="~/.heroku/credentials")).split("\n")
   heroku =, pass)

   cmd =[])
   remotes = cmd.git_remotes(File.dirname(__FILE__) + "/../..")

   remote, app = remotes.detect {|key, value| value == (ENV['APP'] ||}

   if remote.nil?
   raise "Could not find a git remote for the '#{ENV['APP']}' app"

   `git push #{remote} master`


Anyway, I kind of rushed this, because I wrote most of the post about a month
ago and then forgot about it. Once I am happy with theStack, I'll write
another post here about coding with Sinatra, ERB, less, Sequel, and Heroku.



Related Posts

I still don’t understand award shows, I don’t understand how they get five people who work their entire life, won, sold records, sold concert tickets, to come stand on a carpet and for the first time in they live be judged on a chopping block and have the opportunity to be considered a loser. I don’t understand it bro. I don’t understand when the biggest album or the biggest video, I still don’t understand it, I been conflicted bro, I just wanted people to like me more. But fuck that bro! -- Kanye West, MTV VMAs 2015-08-30

So I was reading John's Post and I started to think about my life plan. Needless to say, it's not really a plan, but more of an idea. This idea being "make others happy, be happy, and stay happy."