This week in #dev (Pilot)

Matheus Richard

This week in our Slack channels

We usually avoid private messages. Among other benefits, it helps us to share knowledge across the company. Many interesting conversations and discoveries happen on public channels like #dev or #design. These are some of the most valuable resources we have, and now we decided to share some highlights with you, dear reader!

Here’s a selection of the most interesting conversations that happened in our #dev channel this week:


Ruby’s Kernel.abort

Matheus shares that he has often created a method like this for scripts:

def exit_with_error(msg)

Recently, he discovered Ruby’s Kernel.abort which essentially does this out of the box.

Rolling back Rails migrations

Elisa Verna shares how using rails db:rollback STEP=number is much more convenient than running migrations down individually by version number. Steve Polito also mentions rails db:migrate:redo, which is a shortcut for doing a rollback and then migrating back up again (and also accepts the STEP parameter).

# Rollsback and up again 3 migrations
bin/rails rails db:migrate:redo STEP=3

Formatting lists in JavaScript

Did you know that JS has its own version of the famous Rails convenience to_sentence?

const vehicles = ['Motorcycle', 'Bus', 'Car'];

const formatter = new Intl.ListFormat('en', {style: 'long', type: 'conjunction'});

// expected output: "Motorcycle, Bus, and Car"

It’s worth checking the other constructors available, like Intl.NumberFormat.

Formatting Java code

In case you’re working with Java, Mike Burns shares a quick guide on how to format a selection of code (or the whole file) using IntelliJ.


This edition was brought to you by Elisa Verna, Matheus Richard, Mike Burns, Neil Vilela and Steve Polito. Thanks to all contributors!