Quantcast
Channel: iain.nl
Browsing index pages (133 articles)

alias_method argument order

If you're anything like me, you can never remember the argument order for alias_method. I always think to myself "it's the other way around than I think it is", but then end up doing it wrong anyway....

View Article


Sass 3.2 blocks

A lot of websites have side bars. On normal desktop browsers, this fits nicely. But on smaller screens, it will create horizontal scrollbars. And those are a bad user experience. Luckily, CSS supports...

View Article


Testing ActiveRecord in isolation

Testing ActiveRecord doesn't have to be slow. With some clever loading you can require only the parts that you need and it isn't even that difficult. Another reason might be that you're using...

View Article

Getting the Most out of Bundler Groups

Did you know you can create as many groups in Bundler as you like? You can and I think you should! Let me show you some ways I use groups to clean up my Gemfile. Why groups? Speed: Requiring gems can...

View Article

Backends in Rails 3.1

If you find yourself needing a backend interface, you can either get an admin plugin of the shelf, like RailsAdmin or ActiveAdmin, or build your own. The of-the-shelf options provide a lot of...

View Article


Cucumber vs. Steak

Jeff Kreeftmeijer talked about Cucumber and Steak at the last Amsterdam Ruby Meetup. He hit upon an important theme in software development: reducing complexity; in this case the extra layers of...

View Article

Easier MetricFu with Metrical

TL;DR: I've just released metrical. It is a tiny wrapper around metric_fu. MetricFu is awesome. It helps me keep my code clean by identifying problem spots in my code. Unfortunately, it's difficult to...

View Article

Image may be NSFW.
Clik here to view.

RSpec Array Matcher

If you're testing arrays a lot, like ActiveRecord's (named) scopes, you should know the following RSpec matcher: =~. It doesn't care about sorting and it gives you all the output you need when the spec...

View Article


Your argument doesn't cut wood

About once a month I read an article on comparing Ruby to another programming language. Usually it makes the point that Ruby is dynamic and open and therefore it is less suited for reliable...

View Article


Gemfile vim syntax file

I've updated my Gemfile syntax file, adding a dash of color and making sure it supports all elements of the Bundler DSL. You can get it here. You'll also need to tell vim to automatically use it when...

View Article

Building Blocks of DDD: Services

As promised, here is an example of how to use the idea of services from Domain Driven Design to help you design your code better. Let's start with some theoretical stuff, before we dive into some...

View Article

Domain Driven Design: Building Blocks in Ruby

A few weeks ago I talked about Domain Driven Design in Ruby at the local Ruby user group: Rotterdam.rb. It had a great turnup (even though the weather prevented some from coming) and there was a good...

View Article

Image may be NSFW.
Clik here to view.

Customizing IRB, 2010 edition

TL;DR: Check out my new .irbrc-file! Customizing my work environment is a nerdish hobby of mine. I spend far to much time tweaking my terminal. While I'll save my terminal customizations for another...

View Article


Using Sass with jQuery UI

Want to build a quick website or backend? Want to make it look good, but without adding too much effort in it? Then this recipe is for you! The jQuery UI framework contains some nice styles and some...

View Article

About structs

Recently I talked about a monkey patch called attr_initializer, allowing you to write code like this: class FooBar attr_initializer :foo, :bar def to_s "your #{foo} is #{bar}" end end FooBar.new('foo',...

View Article


Cheating Performance With A Little Javascript

This little trick works with most websites with a menubar. When you have a menu that changes color pending on which page you are, you can cheat a bit on the perceived performance of loading pages. And...

View Article

Helpers Are Code Too!

I think I've talked about this before, and there has been a Railscasts episode about it too, but I want to touch on it again. I know we're supposed to keep views simple, but that doesn't mean that...

View Article


Image may be NSFW.
Clik here to view.

Conway's Game of Life; or: Writing Perl in Ruby

We had a programming exercise this week at work. We were set out to write Conway's Game of Life, using pair programming and TDD. It was a fun and educational evening. I even did some Scala. Programmers...

View Article

ViewTranslator, a dynamic dispatcher

I'm a sucker for syntax. So once again, here's a small experiment. It might not be the most useful snippet out there, but maybe it inspires you to do something awesome. The 'Dynamic Dispatcher' is a...

View Article

Qu'est-ce que c'est Rubyesque?

This is a translation of the post I originally wrote down in Dutch for my company. I recently gave a presentation at my company Finalist IT Group about the philosophy behind Ruby. Code written with...

View Article
Browsing index pages (133 articles)


Latest Images