All Posts

Put some Go in your Ruby so you don't Rust

Lately I have been looking for some solid alternatives to Ruby, and I must admit up-front - Rails spoiled me, badly. I was hungry for some performance boosts, and let’s face it - dynamically typed languages can get you until some point. I played with few popular modern languages (manually dealing with memory management? No thank you sir) and tried to hook them into Rails application.

How to alter big postgres table

Lately I had to migrate pretty fat (300GB+ data and 150GB+ of index data) postgres table - application grew, we had to get rid of one pretty big column that was redundant now, change main composite index, change one column type etc. etc. The problem was - do it without significant amount of downtime.

Getting the best of your Rails continuous integration

You’re using CI? Great! You are not? It’s perfect time to start ;-). Continuous integration (along with continuous deployment) is pretty simple and pretty awesome idea. Can basic setup where you simply run tests, and assuming tests passed whole thing gets deployed into production server(s) be done better? Lately I gave some thought to the whole deployment process in our company. The whole development process in fact. I think todays web development got soooo complicated when compared what it was few years ago.

Graceful unauthorized pdf redirect with devise (custom failure app)

Let’s say your users are trying to access some pdf files that you’re serving inline with wicked_pdf or any other gem of you choice that is a wrapper for wkhtmltopdf. But they have to sign in first. What happens when you use devise and you hit pdf url as unauthorized user? By default your app will respond with 401 Unauthorized which will get converted into invalid pdf file and this kinda not what you want. Probably ;). This can be fairly easy resolved with the help of custom failure_app. Let the code speak for itself:

Migrating from MacOS to Ubuntu

Reasoning I’m not a huge fan of Apple products, been using mostly linux during my professional career (d’oh). I can appreciate the overall hardware build quality (well - at least when it lasts), easy of use (it just works) and all that jazz, but after working on MBA for two years I decided to look around for new machine that would serve me for another few years (hopefully).

WAN DHCP mystery on Tomato software

Lately I’ve been messing with my home network - long story short I ended up buying new router because my old Buffalo WZR-HP-G300NH was starting to having problems with wifi signal strength out of the blue. So I ended up with NetGear N300 v2 running Tomato by Shibby and a smaller one TP-LINK WR710N for the other room. And here is the kicker - none of routers was able to obtain IP address on WAN port via DHCP (after cloning mac address of wan port, as mac was filtered by my Internet provided).

How I failed to create Vagrant-based Ruby On Rails environment

Did you ever tried to solve a problem of unified development environment? It’s hard. I mean - seriously. ‘It works on my machine’ - how many times did you heard that? So you have Vagrant or Docker or maybe some other brand-new-solution. With Vagrant you basically build a whole VM environment, with Docker it’s another story (assuming you’re running linux).

Extracting form objects in practice

Did you get to the point where your model is over 1k lines longs and moreover stuffed with various concerns? If so - maybe it’s time to think about extracting so called form models (Ruby/Rails community always have fancy names for most simple things :p). What is a form model? It’s simply a Ruby class (d’oh) that encapsulates logic related to a single operation. Dead simple example that comes to mind is some kind of a sign up process that exists in almost every web application.

Vagrant setup for multiple subdomains application (dev box)

Problem Build a vagrant development environment that will serve an rails application that works on multiple subdomains. Moreover that application consists of multiple smaller apps that all are running with a single domain.

Rails 3.2 to Rails 4.1 upgrade

Let’s talk about pretty tedious task - upgrading rails, of course it can be interesting experience, but if you have relatively large application to upgrade it can be cumbersome, here are my thoughts after doing through process of switching Rails 3.2 to Rails 4.1.