Grosser - grosser.it - Michael Grosser, the Blog

Latest News:

Logging and showing colorful bash output 6 Aug 2013 | 09:44 pm

Deploy using the deploy user and also log who deploys using the original user. Retaining the color was tricky but script fakes tty so we can keep all the color glory and with sed we strip colors befo...

Ruby: retrying multiple times without loops and retry counters 5 Jun 2013 | 08:59 pm

A nice way of not keeping track of retry counter and not using a loop 3.times do begin raise "Nope" rescue puts "Failed" else puts "Success" break endend Tagged: Ruby

Prevent missing type / NameError in polymorphic ActiveRecord associations 12 Apr 2013 | 10:32 pm

ActiveRecord loads the xxx_type in your model, making it blow up when doing includes / using the belongs_to on a missing type. So we make it un-missing. Usage class Waldo "1 = 2", :limit => 0 self.tab...

Passwordless ssh auth into your vagrant box 9 Feb 2013 | 10:25 am

Repeatedly entering password is quiet annoying, luckily most vagrant base boxes come with the same insecure ssh key curl https://raw.github.com/mitchellh/vagrant/master/keys/vagrant > vagrant.key chmo...

Enqueue into Sidekiq via pure Redis (without loading sidekiq) 18 Jan 2013 | 04:44 am

We want to enqueue jobs, but do not want to blow up the app with sidekiq and it’s dependencies. Usage RawSidekiq.enqueue("XyzJob", [1,2,3], :namespace => "custom") Code # http://grosser.it/2013/01/17/...

Kill ActiveRecord observers 5 Jan 2013 | 03:53 am

Killing observers decreases startup time by not loading all your models makes it possible to preload config/environment.rb and still test models -> spin/zeus makes dependencies obvious replaces Active...

Upgrading to rails 3.0 — making sure you use rack headers everywhere 19 Oct 2012 | 08:03 pm

Normal headers like Accept or :authorization do not work in rails 3 integration tests and you need to convert everything to HTTP_ACCEPT etc, to help find all those places and make sure you do not intr...

Rails 2: Your integration tests are lying 19 Oct 2012 | 08:00 pm

Integration tests call the whole rack middleware stack, but stubbornly return the last controller response, which can be completely different especially if you use warden or other middleware-tools. Se...

Making sure you are not creating unwanted actions by including Modules 21 Sep 2012 | 03:30 am

This will blow up if someone includes a module with public methods that would count as actions. # application_controller_test.rb class ApplicationControllerTest

Airbrake error backtrace summary 8 Sep 2012 | 08:59 pm

We often have an error with a few thousand occurances and want to find out which code paths caused it. Usage Use auth-token from settings page, not your api-key. ruby airbrake_backtraces.rb your-accou...

Recently parsed news:

Recent searches: