Jolie Rouge

all ur parentheses Я belong to me

Backbone.js + Rails

You all know that my opinion of Ruby On Rails couldn’t be any lower if it was under the basement carpet of a Pompeii1 house, so this post won’t be very suprising.

So, awhile back I was having a discussion with a  friend about how, as a general rule, about 90% of a web app should really be taking place on the browser, and this was vindicated in my opinion with several other developers coming to much the same conclusion and releasing some very interesting application frameworks for javascript Single Page Applications. Of course this conversation took place when jQuery was just really starting to take off. The problem at that time was that no one was really talking about a client side application in javascript methodology, how such a thing could or would work.

In hindsight it all seems obvious, but actually, Backbone and other such frameworks represent some really great out of the box creativity. Anyway, after my last Rails project, I more or less swore I would never work with that ass backwards platform ever again. I decided to revisit this idea of Single Page Applications and low and behold I stumble onto Backbone.js, and I decide I am going to learn to use this tool. While looking around for some books on the topics of jQuery and Backbone (I’ve more or less decided to give up the ghost and use jQuery ui elements in all future applications cause rolling your own is just too much work.) low an behold I find a link to this: I thought to myself, you have to be shitting me. Mixing Backbone.js and Ruby on Rails is like taking a sexy girl back to your apartment and making her diddle herself across the room while you try to solve a Rubik’s Cube with your toes.

Rails is the big shining Mecca of Shit2 that passes for a software platform these days, so I understand that all the new kids want to make use of cool by association until graduation is over, and everyone realizes that the flashy douche bag will end up a used car salesman, slowly killing his soul, beating his wife and kids, and crying himself to sleep in a second hand recliner while he reminisces about the glory days over a bottle of cheap scotch.

Normally I would find such an ironic situation truly sad, but must admit the idea of a pot-bellied DHH sobbing like a little girl into a dixie cup filled with Tambowie is strangely satisfying.

The whole idea of Rails, the fundamental flaw of Rails can be summed up by drawing you a nice little picture.backbonevsrails

Rails will_paginate links to wrong page


While setting up a website today I found a bit of retardation in will_paginate. Aside from poor and complicated documentation and an incredible amount of bloat for what amounts to a very simple kind of website component, I found that will_paginate was linking to /?page= on a page that showed in the url bar as /products, so the link should have been /products?page=. So I looked around for a quick fix, and this is the best I got: Revisited: roll your own pagination links with will_paginate and Rails 3

OH MY GAWD. You have to be shitting me. That is hands down the most retarded thing I have ever seen. So, like the little hack monster that I am, I did it faster and easier with less code. If you want to change the pagination links, you can do it with jQuery.

$('div.pagination a').each(function () {
    var url = $(this).attr('href');
    url = url.replace('/','');

Never Again! Backing up your rails .sqlite3 dbs

Well, with mysql, it’s pretty hard to overwrite your dbs, but with sqlite, it’s real easy. I did this, luckily I only lost about a days worth of work, but nevertheless, I have instituted a new rule for sqlite3 dbs: Hourly backups.

Here’s the script:

D=`date +%H`
cp -f /var/www/app/db/production.sqlite3 /var/www/fapp/db/production.sqlite3.bak.$D

Rails 3 Migrations Cmdline Builder

Here is a little tool for making your migration commands.