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.
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.
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!
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).
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.
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.
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.
Lately I’ve been implementing Instant Payment Notification - great feature provided by PayPal. To be honest it cost me quite some time and a little bit of my dignity. I mean you can read the official guide and play with Instant Payment Notification (IPN) simulator - but in the end it’s back to trials and errors.
So here we go, here are some tips for you, I hope you will find them useful and it will save you some time.
Morris.js is great, simple and lightweight charts library powered by jQuery and Raphael. Unfortunately you may encounter an issue when you will try to plot a chart on element with display:none property - for example when using Twitter’s Bootstrap tabbed component - it just doesn’t render properly. So as a quick workaround you can fire-up after showing that element.
Bootstrap provides some neat javascript events that are fired after some specific actions.
Rails is a great framework, isn’t it? It’s ships with all those great tools witch are supposed to help you automatically test your application. So you write specs, you practice TDD, BDD or maybe DDD, but over time you may notice something - it’s getting painfully slow. You app grows, your test suite grows and suddenly testing isn’t anymore so much fun as it supposed to be. You feel like it’s slowing you down.