random thoughts

REST API Client Server with Rails

Few days ago a new project was thrown in my face ;). And it was interesting I must say - extracting some heavy internals of existing application into internal API + external client (app), that could be developed further with some additional features.

REST API Client Server with Rails

Debricking Buffalo WZR-HP-G300NH (linux)

If you’re reading this you’re that means you don’t need further introduction to the problem, let go straight to solution then ;).

Debricking Buffalo WZR-HP-G300NH (linux)

Migrating from resque to sidekiq

In a company I’m currently working we have been using resque to do some heavy asynchronous work. And well, that’s like obvious choice in Rails world - just go with resque, fork some processes and relax ;). But when you get to a point, when you need few hundred workers and few servers, you start to ask yourself - can’t you do it better?

You probably can. There are some pretty smart folks out there, who were so kindly to share their knowledge. And that’s how you can find sidekiq build on top of celluloid.

Sidekiq uses multi-threading, so you can leverage that even if you use MRI (that have un-famous GIL) - if you have a lot of I/O bound work you can still benefit from this great piece of software (even without need to migrate to JRuby or Rubinius).

Migrating from resque to sidekiq

API-like gem for fetching data from quakelive.com

It has been a busy time for me lately, but I finally managed to release a small gem, that some of you might find useful. You can download it from github or rubygems, I attached readme, that should be sufficient enough to start hacking. As you may already know ID Software unfortunately didn’t provided official API, so if you want to get some data from them, your only option is to crawl their site.
API-like gem for fetching data from quakelive.com

Rails after_commit create mindf*ck

Rails 3 observers can be tricky. You probably already heard a thousand times how to deal with undefined id issue and how transactions are handled, so let’s take a quick example that can be google’d in just a couple of seconds.

Rails after_commit create mindf*ck

Windows-1250 to utf-8 bash one-liner

There was a time when I worked with non utf-8 coded files quite a lot. They were usually saved using Windows-1250 encoding and obviously I wanted them in utf-8. I think I don’t need to tell you that you should probably use iconv for that, but there is also quite interesting tool called sponge that will allow you to pipe output of iconv to the very same file. In ubuntu it comes with packed called moreutils (also check out other apps it provides!
Windows-1250 to utf-8 bash one-liner

Delayed::Job to Resque migration

When it comes to doing some asynchronous work, Ruby on Rails community have some great ready to use solutions to choose from. I think most popular is delayed_job and resque (and probably sidekiq, but a story for another blog post).

Delayed::Job to Resque migration

Fixing Bluetooth audio issue on Ubuntu 13.04 based distors

I’ve noticed that Ubuntu 13.04 (and all distors based on it, eg. Linux Mint 15) have some weird audio issue that basically makes impossible to connect to some audio speakers through audio sink (I had problems with mine Creative T12). After googling around and trying all possible solutions I still couldn’t get it working. Syslog showed various errors, for example: Unable to select SEP or Endpoint replied with an error: org.
Fixing Bluetooth audio issue on Ubuntu 13.04 based distors

How to migrate from Mina to Capistrano

It’s been a while since I last posted here. I’ve been pretty busy with work, I’ve also moved to Cracov in the meantime - so yeah, I can’t really complaint about boredom ;).

Anyhow, some time ago I posted about Mina - neat little gem that allows super fast deployments. Unfortunately when your project grows you start adding additional bash scripts, you add more and more commands to your deploy script and it grows into something not-so-neat anymore.

That’s why tempted with Capistrano’s ready-to-use recipes I decided it’s time to say hello to Capistrano. I’ll provide here step-by-step migration process from Mina. I will be using here delayed_job, unicorn (with capistrano-unicorn gem) and thinking-sphinx.

How to migrate from Mina to Capistrano

Bootstrap 2.3.0 and lightbox/fancybox crash issue

After upgrading bootstrap to version 2.3.0 I spent an evening trying to figure out what’s causing too much recursion error that was in the end crashing my entire browser when using lightbox or fancybox. Then I said - frak it, it’s time to get some rest and in the morning I decided to visit github issues section first - and let me say I should start there, because there it was - waiting for me - exactly the same problem with possible solution :P.
Bootstrap 2.3.0 and lightbox/fancybox crash issue