Digests » 323

this week's favorite

Elixir’s hidden potions

When I first started writing Elixir I fell for the expressive power of pattern matching, the refreshing first-class consideration of testing and documentation and the gorgeous syntax. It’s become my favourite language; and even though it has the most supportive community I have seen from a programming language, it still contains many exceedingly useful hidden talents.

Cache API token in Elixir

Probably most of the APIs that you call are protected somehow. The most common way to do that is to provide token with expiry date. We are not going to explore how to manage tokens on API side but we are going to deal with them on client side. If you want to read more about how to generate tokens please read: Phoenix.Token.

How to correctly install Erlang and Elixir

At Coletiv we have a lot of Elixir projects, and some of them more recent, others started years ago. Those older projects will, most certainly, use older versions of Elixir & Erlang and, as another thing to take into account, not all elixir versions support all Erlang versions and vice-versa.

Instrument your Elixir application

Somewhere during the lifetime of an application it's inevitable that it will have some performance issues. When that happens it's better that you have some kind of observability, otherwise it will significantly increase the time you'll take to find what's slowing it down. It may sound a bit cliché but it's 100% true that we can't understand a system if we can't look inside it.

Testing Phoenix and Elixir: Centralize data creation in the factory

Factories in Elixir are modules that handle inserting data into your database. They can also be responsible for handling the generation of any test-related data. Ex Machina is a popular library for creating factories. However, you can also build your own from scratch.