☄️ Thiago Araujo

You want to become a great ruby or elixir developer, but there are lots to learn! Follow me and I’ll help you write professional Ruby on Rails and Elixir Phoenix applications.

A bowl of spaghetti.

Learn Ruby on Rails Best Practices With One Exercise

You want to write smooth professional-looking code. You’re craving some squeaky-clean code. But all you have for lunch every day is a big bowl of legacy spaghetti code. You consider yourself a decent developer, but you’re never sure how to organize a project. How to name things. Where some piece of business logic should live. How can you become a Ruby on Rails expert if the code you read every day stinks?...

June 30, 2021 · 5 min · Thiago Araujo
Waves black and white pattern

How to Write a Clean Order By Case Query with Arel on Rails

You’re working on a feature and someone tells you that one of your models needs to be ordered based on some complicated rule. You realize you’ll need to write a complex order by query… Here’s how it usually goes: You think to yourself: “Should I write an order by case when statement? Maybe I’ll just add a little bit of SQL…" Two minutes later, you end up with a bunch of nested case when statements, subqueries, common table expressions, angry statements, shouting, and a whole lot of tears....

June 10, 2021 · 4 min · Thiago Araujo
Orange and white triangles pattern

What's the Best Way to Learn Webpack?

If you’re feeling lost whenever you have to add some javascript library to your Rails application, this post is for you! I see a lot of people battling against Webpacker whenever they need to add a new javascript library or have to fix a bug on the asset pipeline. I suffered from the same problems, too. I talked about why this happens on a previous post: “Adding Bootstrap or Javascript Sprinkles to Rails breaks everything....

June 5, 2021 · 3 min · Thiago Araujo
Old man yells at Webpack

Adding Bootstrap or Javascript Sprinkles to Rails breaks everything. What should you do?

Did you spend a billion hours trying to add jQuery, or Bootstrap, or Tailwind to your Rails project, but now everything on the frontend is broken? Or worse: you can’t even tell whether the frontend is broken or not. It’s in a unkown state of brokenness. Maybe you just want some javascript sprinkles, but Webpacker makes things so much harder and frustrating. Do you wait until an angry customer complains about the checkout button not working anymore to know which page to fix?...

June 4, 2021 · 3 min · Thiago Araujo
Red and blue shapes pattern

Move From Sprockets to Webpacker On Small to Large Rails Apps

Rails 6 comes with Sprockets and Webpacker by default. Confusing, right? The default configuration is Webpacker for Javascript while Sprockets takes care of all the rest (CSS, images, fonts…). Let me tell you a secret: You don’t need both. Just use Webpacker. Legacy applications and older gems still use Sprockets to serve assets. This was done to add backwards compatibility. If you don’t have a good reason to keep Sprockets around, don’t....

May 24, 2021 · 4 min · Thiago Araujo
red and black pattern

How to pick your first Rails Issue and start contributing to Open-Source

Did you always want to help an open-source project like Ruby on Rails, but never got started? Many people have the interest of contributing to open-source, myself included. I’ve done a couple of small contributions, but nothing fancy. It’s a little intimidating, right? You’re not part of the group of contributors and you don’t really know where to start. You see 800 open issues, which one is a good one to pick?...

May 12, 2021 · 3 min · Thiago Araujo
A black and white pattern

How should I change production data on a new Rails application?

You need to change production data. You know that doing it manually is unsafe and will definetely cause lots of trouble, like corrupting all you customer’s data. How else should you do it? You might be spending a lot of time asking yourself these questions: Is there a proper rails way to change data in production? Should I run data and schema modifications in one database migration? Should I run rake scripts in production to modify data?...

April 13, 2021 · 3 min · Thiago Araujo

hexdevs podcast

My wife and I are launching the greatest podcast in the world and a new site called hexdevs! We’ll talk about how to start a business, and how to get better at your craft. We want everyone to be more confident, successful, and smarter, so if you want to become an awesome dev, listen to our podcast and sign up for the mailing list! And stay tuned! ...

July 17, 2019 · 1 min · Thiago Araujo

Generic JDBC Queries on EMR Zeppelin

The EMR (Elastic Map Reduce) service on Amazon has some nice packages that come pre-installed, and one of them is Apache Zeppelin, which is a Jupyter Notebook interface for Spark. Zeppelin has interpreters for spark, pyspark, spark-sql and others, but if you want to run spark-sql code on a PostgreSQL database, you need first to install the JDBC interpreter and add some extra configuration to Zeppelin. The JDBC adapter supports a wide variety of database engines, and it allows you to configure multiple database connections, which makes data exploration much easier....

April 3, 2019 · 5 min · Thiago Araujo

Fast ElasticSearch Indexing with Apache Spark on EMR (overview)

I’ve been building the data infrastructure for a project and I needed to efficiently query, merge, process and clean terabytes of structured data and then index hundreds of millions of documents on elasticsearch. The problem is that querying and joining data on a RDBMS like Postgres is very painful when you have more than low terabytes of data. You’re going to spend a huge amount of time tuning your database, reading query plans, adding indexes, sharding, and slowly moving data around until you have something decent that take hours, days, maybe weeks to run....

September 6, 2018 · 4 min · Thiago Araujo