Rails Engine

at Melbourne Ruby meetup

I did a presentation about Rails architecture with Lean Engines approach at November Ruby Melbourne meetup.

Download PDF Slides

Modern Software Engineering

by David Farley

It's a really good book that talks about software development fundumentals. It didn't change my mind, as I already knew most of it. However I found it useful to reiterate the argument why those fundumentals are important. I did find the book a bit repetitive at times, but not enough to be distracting.

The book is well structured and easy to follow. The book suggest two main parts which we should optimise for: learning and complexity.

“Optimize for Learning,” looks at how we organize our work to allow us to make progress in small steps. How do we evaluate if we are making good progress or merely creating tomorrow’s legacy system today?

“Optimize for Managing Complexity,” explores the principles and techniques necessary for managing complexity. This explores each of these principles in more depth and their meaning and applicability in the creation of high-quality software, whatever its nature.

The book also covers important topics like: What is software engineering? Is it a craft or engineering? How to measure software? How to evaluate external tools? and more.

I would recommend this book to all software devevelopers, senior or junior.

Preventing the Collapse of Civilization

by Jonathan Blow

So turns out I'm not the only one who thinks that and see no progress in software.

Hammer time: Static blog in ruby

at Melbourne Ruby meetup

Download Slides PDF or read more

Reading RubyWeekly. Next level achieved!

(With a bonus)

RubyWeekly is a weekly email with curated list of links about Ruby. It might take me few hours to read through it if the content is interesting. It’s hard to find 2 hours of focus time. It would be nice if I could track each link in the newsletter separately.

This blog post describes my evolving solution and how you can optimise your workflow and read RubyWeekly with one click.

Rails in real-time

at Melbourne Ruby meetup

Download Slides PDF or read more

Do you have enough tools to collaborate?

or why Basecamp and Github so popular

Selecting good communication and collaboration tools for work, is just like having a solid foundation for the house: if it’s flawed then you can’t avoid the cracks in the walls.

  • Why there are 100 channels in Slack?
  • Why we’ve started using tool X but it does not work for us?
  • Why do I receive 50 internal emails every day?

Often it’s our ignorance of communication theory that caused all of that.

The article will give you a model which will help you understand why new tools don’t fit into your company and why existing tools are abused in their usage. I will describe the five main categories of collaboration and communication tools and explain their purpose and needs along with the tool examples.

Let’s start with something popular.

Cron on Heroku in 5 minutes

I wrote a small Rails app, which sends emails on a particular schedule. For example to send an email every week on monday and thursday at 7:00am Melbourne time.

However Heroku doesn’t have cron or good free alternative. I wrote a cron replacement in 5 minutes. This post shows how I did it. There are three parts:

RSS readers and missed opportunity

The story starts with the RubyWeekly newsletter. Once signed up, every week you’ll receive a collection of curated links. It’s a great resource to learn Ruby. It could take a few hours to read through the interesting articles.

I found it hard to set aside 2-4 hours every week to read them in one go. So I wrote a script parses each week’s issue into an RSS feed. The feed had one item per link, which gave more granular control.

99 bottles of OOP

by Sandi Metz & Katrina Owen

This book is very hyped this year. To summarise it's a detailed refactoring tutorial. It could also be called "Refactoring 1-on-1 for dummies".

I like that it goes through long and tedious process of proper TDD. I don't like for the exactly same reason and had to skim through it. People who are not familiar with TDD should find it very useful.

The book was a good detailed reminder of the refactoring process for me. However I wouldn't recommend it to myself.

A pitfall of the &. operator in Ruby

Update 1: The article was translated to Japanese

Update 2: This post is featured in RubyWeekly #374

The &. operator, added to Ruby 2.3, is handy and I’ve cleaned a lot of code with it. You can use it in conjunction with default operators as described in Ruby's New &.!= Operator.

Recently I introduced a bug when using &.. First we had:

if start_date && start_date < start_of_month && end_date.nil?
  # …

Meta presentation

at Melbourne Ruby meetup

Unfortunately this presentation had a lot of transition and my recording failed, so please have a look at the transitions in video slides below.


Growing Rails Applications in Practice

by Henning Koch and Thomas Eisenbarth

A quick read which I would recommend to every mid rails developer and higher. It's common for developers to outgrow their tools. Rather than learn new skills, people start to blame the tools. Your heard those people: "Rails does not scale", "ActiveRecord is antipattern" etc. The books show few patterns which allow to build big Rails application with only small changes to standard 'Rails way'.

The book recommends active_type gem. I would recommend other gem active_interaction instead. active_interaction gem is more superior in my opinion and I've successfully used it in multiple projects over the last 2 years.

As for the CSS structuring, BEM is definitely a good choice to get control over your styles. Only issue with it, if not enforced it loosed its value, so every developer should be very diciplined to follow BEM.

There is only 1 option which is better than BEM, it's css modules. I only used it with ember.js, not Rails though. It automates steps that you have to do with BEM. However css modules require deep integration into the tools you use, which makes it harder to bring into the project.

The Art of Readable Code

by Dustin Boswell & Trevor Foucher

This quick and easy to read book I would recommend to every developer. It talks about all the little things which are often neglected and what developers deal with every day. Naming methods and variables, extracting business logic, code comments, aesthetics and code readability.

This knowledge is language agnostic and the best mastered over reading lots of code, or reading this book :)

Parallel rendering in Rails

Discussion on Reddit

I will continue to expand the features in the pagelet_rails gem. Since it offers a new way of composition in Rails I've found that there are so many new things we can do. In this post, I will focus on the parallel rendering. Yes, that's right, parallel rendering in Rails. Although, it may sound advanced the concepts behind it are extremely simple. This post however is only relevant to web page rendering.

Update 2: This post was featured in RubyWeekly #318

Improve perceived performance of your rails application with minimum effort

at Melbourne Ruby meetup

Download Slides PDF or read more


Favourite gems

from Rails Camp 19

I've been asking people for the gems they would recommend to others at Rails Camp 19. This is a compiled list of answers.

Math challenge

Last friday one of my friend gave me a math challenge. You've given four numbers 6, 6, 5 and 2, you need to find 3 math operations to get 17 as a result. You have to use all four numbers and only once each. Order of numbers can be any.

I couldn't figure it out in my head so have to write a ruby script to iterate over all combinations, which turned out as a great coding exercise.

Bystander effect

The bystander effect, or bystander apathy, is a social psychological phenomenon that refers to cases in which individuals do not offer any means of help to a victim when other people are present. The probability of help is inversely related to the number of bystanders. In other words, the greater the number of bystanders, the less likely it is that any one of them will help.

-- Wikipedia

Kelly's 14 Rules & Practices

Skunk Works by Nickolas Means

Ruby Inline Tests

Did you know you can inline tests with your ruby code in the same file?

After reading the title Embedding a Test Suite in a Single-file Ruby App (Part 1) I thought: aha! finally somebody has done it and used ruby data block to store tests. However I was disappointed as there was another approach, which I think is less elegant.

Below I show you a proof of concept of embedding tests in ruby code.

Rails as a static site generator

Looking for static site generator? Look no more, use Rails!

Embedded widgets with Ember.js

at Melbourne ember.js meetup

Ruby Community

at BrisRuby meetup

Last 2 year

at BrisRuby meetup

Debugging Poltergeist and PhantomJS

Recently at Opensight we had weird issue with our integration tests. When we run single test it succeeds, but when whole suit it fails.

It was failing on the same "terms and conditions" page where we expect 'Accept' button: could not find element Accept

click_button 'Accept'

Circular dependency in Rails

This is an interesing bug I've encountered this week. While our Rails application was working in development it was completely broken in UAT environment (which is 99% production like)

We were getting Circular dependency detected while autoloading constant error on all of our reports.

Multiple logins at once with Browser Profiles

Do you:

  • share same computer and login with other family members
  • or you are testing website with login

Then you should know what browser profiles are.

Differentiate your gem

Are you tired of seeing yet another project on github while there are ten others which do exactly the same thing? In this post I suggest we start to diffirentiate our projects.

Comparison in Ruby

at BrisRuby meetup

Speed up POW DNS Lookup

I'm using POW as a proxy to my local dev server in development. That gives me nice local *.dev domain names. However I've noticed that it takes 10 seconds to load a singe page in Chrome. Of course, I thought, It does like 80 requests as each asset is served as a separate file in development. But after investigating it a bit more DNS lookup for each request was 3 seconds and for some reasons it was like that for every single http request.

Report rake (>=0.9) exceptions to NewRelic

NewRelic service is great for application monitoring and errors tracking. However it doesn't track rake exceptions by default. You can use AirBrake gem and service, but sometimes it's too much for you. Fortunately with a bit of ruby it's easy to do it yourself.

Zeus with RubyMine 6.0 Momiji

The first version of RubyMine with Zeus support was released last week. This is a small tip how to get it working.

My last three projects - wins and failures

at Brisbane Web Design meetup

Order of columns in table index matters (postgres)

Today was trying to figure out why my query was running very and very slow.

gem install mysql2 - fails with MySQL 5.6.12

If you installed the latest mysql with homebrew, my version of mysql was 5.6.12. I couldn't install mysql2 gem

gem install mysql2

Quickly open files in iTerm with RubyMine on MacOS

You can use RubyMine for editing but still run tests in terminal. With this tip you can click path in terminal and open that file in RubyMine.

D3.js workshop

at CampJS



Nested Resources

at BrisRuby meetup

Dragonfly gem

at BrisRuby meetup