dimroc The Development Blog of Dimitri Roche See Experiments

Taming Callbacks in iOS: Bolts Framework

Managing many asynchronous events in iOS can get hairy, but it's a fact of life when working with remote services. So how do we avoid callback hell?

Promises (aka futures).

Below I'll explain why I chose the Bolts Framework (BF) over PromiseKit and ReactiveCocoa.

Read More

Not all Migrations are Equal

You've been using Active Record Migrations to manage changes in your database and you love it. But then a model's validations change, and all your existing data becomes invalid.

What do you do? Place it in an AR migration? Depends. Those are primarily for schema migrations and this is not a schema change.

You need to run a data migration.

Read More

Eager Pagination with Elasticsearch-rails

So you're searching millions of records with Elasticsearch-model but want to eagerly load all associations when rendering your page for performance reasons. But wait, you're using Kaminari for pagination, and when you includes(:association), you lose the pagination support.

Below, you'll see how a simple delegator will relieve your woes and eagerly load associations with support for pagination.

Read More

Arelastic for your Elasticsearch Queries pt.1

When doing more than just a simple search with Elasticsearch-rails, a naive approach will lead you to this mess:

response = Article.search query:     { match:  { title: "Fox Dogs" } },
                          highlight: { fields: { title: {} } }

Don't be a sucker! Read on to see how Arelastic can save you pain.

Read More

Pundit for Roles on Rails

Roles are almost always a requirement for a web app. There are many good options out there for Rails, with the old guard being CanCan and Rolify. But then I met this newcomer, Pundit, and its simplicity stole the show.

Read More

Toggleable Fakes for better integration testing

During the development of iOS Project Monitor, I ran into the need to test against a few third party services. Engineyard's Andy Delcambre gave a great talk on how to use test matrices and fake services to write one test that hits both your fake and the service.

Read More

A better error handling future for iOS with Swift

Pattern matching is a fantastic mechanism prevalent in functional programming languages, and Swift has it! Below, we'll find out how to use it to encapsulate errors in asynchronous code.

Read More

Comparing Golang, Scala, Elixir and Ruby for ETL

How do the following languages stack up when running an extract, transform, and load (ETL) against ~40M tweets? Read on to find out more.

Read More

Elasticsearch behind NGINX on AWS

Hosting on Heroku or any other multi-tenant PaaS means you're sharing IP security with other people. Now your web services require at least basic auth when interacting with services like MySQL and Elasticsearch. We will run Elasticsearch behind nginx, which will enforce a username/pw for basic auth.

Read More

Monitoring CI from your iPhone

Ever want to receive a push notification when a commit fails CI? Well, do I have news for you.

Read More