Sinatrarb is classy web-development dressed in a DSL.

Articles on Sinatra

Simple Rules for Stable, Performant and Maintainable Apps

Here are some simple and basic rules I've found for building applications that are maintainable and perform well, both in speed and stability. These rules, at one level or another, can apply to smaller modules and libraries, scripts, as well as fully featured large scale applications (both web and otherwise). In this post I will focus more on web applications, since that's where I've spent most of my time. At a higher level, they should apply to almost all areas of software development.

Hello World: Sinatra vs. Node.js


require 'sinatra'
get '/' do
  "Hello World"


var app = require('express');
app.get('/', function(req, res) {
    res.send("Hello World!");

Syntax Highlighting on Nesta

I recently went through setting up syntax highlighting on Nesta for this site. I started with "Setting up rack-codehighlighter" from the Nesta site, but wasn't loving what Coderay had to offer. Looking at 'rack-codehighlighter' and it's other formatter options and decided to use Ultraviolet.

While this is geared towards Nesta, this will also work for all Rack applications, especially those built on Sinatra.

Diskcached: Simple Disk Cacheing for Ruby

I created Diskcached as a simple cacheing layer for things like html fragments and database calls. I thought about using memcached, but as Ditty is running on a single server, it seemed overkill. Additionally, I looked at using rack-cache, but I felt it was a bit more complex then I was looking for. So Diskcached was born (although it was origiionally released as "simple_disk_cache" -- for about 12 hours).

Setting up NewRelic on Sinatra

This week I spent some time setting a NewRelic application on a Sinatra app. It actually turned out to be so simple that I almost hesitate to do a post on it, but hey, here it is any way.

Configurable Template Engine in Sinatra

A lot of people have taken to using HAML, example "sinatra-authentication" uses it by default. I personally don't like it, but I don't judge either. So that said, I wish that more apps out there would steer away from implicitly defining haml calls in their apps. Here's an easy way to allow the template engine to be configurable in Sinatra

Sinatra Mobile Dection - rack-mobile-detect

I was looking for a simple way to detect mobile devices for this blog, a Sinatra application, and found rack-mobile-detect.

Deploy Sinatra with Vlad and Git

Deploying Sinatra with Vlad the Deployer and Git is basically just deploying with Vlad.