OTP in Elixir: Learn GenServer by Building Your Own URL Shortener

Looking at any programming language you will (hopefully!) find a rich and useful standard library. I started my professional career as a software developer with Ruby, which has quite an easy-to-use and well-documented standard library with a plethora of modules and classes to use. Personally, I find the Enumerable module in Ruby with all its nice methods simply brilliant. You might be coming from a different language, but I am sure that any serious programming language out there has a set of classes, modules, methods and functions to make your life (and work) easy....

January 26, 2019 · 17 min · Ilija

Understanding the basics of Elixir's concurrency model

If you come from an object-oriented background, you might have tried concurrency in your favourite OO language before. Your mileage will vary, but in general OO languages are harder to work with when it comes to concurrency. This is due to their nature - they are designed to keep state in memory and require more expertise and experience to be successful with. How does Elixir stand up to other languages when it comes to concurrency?...

January 15, 2019 · 15 min · Ilija

A deeper dive in Elixir's Plug

Being new to Elixir and Phoenix, I spend quite some time in the projects' documentation. One thing that stood out for me recently is the first sentence of Phoenix’s Plug documentation: Plug lives at the heart of Phoenix’s HTTP layer and Phoenix puts Plug front and center. So naturally, I felt compelled to take a deeper dive into Plug and understand it better. I hope the following article will help you out in understanding Plug....

December 31, 2018 · 16 min · Ilija

Validate your passwords using Elixir and haveibeenpwned.com's API

Unless you’ve been living under a rock for the last couple of years, you probably know what two-factor authentication (2FA) is. It’s quite a neat trick actually - you have a password that you have to (obviously) enter correctly (first factor), but you also have to receive a second (random) code through a different medium, sometimes on a different device, that you have to enter to log in (second factor)....

December 23, 2018 · 11 min · Ilija

Writing command line apps with Elixir

Elixir is a really cool language. Although I do not have much experience with it (yet), I am always trying to build interesting stuff with it and learn the built-in tools. In this blog post I decided to show you how to build a self-contained command line application with Elixir, with some help from escript. Escript Erlang and Elixir have this cool thing called escript. It’s basically a tool that compiles an Elixir app that you have as a command line application....

November 27, 2015 · 6 min · Ilija

Filter request params from Phoenix logs

Phoenix is a really powerful and customizable framework. One of it’s small but important configurations is filtering custom params from the logs. I am sure that this will be more interesting to beginner than experienced developers, but nevertheless, let’s see what’s the motivation behind this and how to do it in Phoenix. Motivation First, I’d like you to understand the motivation behind this and why this is useful. Think about it....

October 23, 2015 · 3 min · Ilija

How to set tests as pending in your ExUnit suite

Elixir’s built in testing library is called ExUnit. It’s a proper testing framework, which, although simple, gives the developers a lot of power and flexibility. If you come from Ruby land, I am sure you’ve been in a position where you want to set a certain test to be skipped. For example, RSpec in Ruby does it with the pending method. Let’s see how we can customize our test suite so ExUnit can skip over tests in our test suite....

October 18, 2015 · 3 min · Ilija

Write and publish your first Elixir library

As some of you have heard lately, Elixir is the new hotness. Is it just hype? Well, I thought so at first, but I told myself “heck, even if it’s a waste of time, at least I’ll broaden my horizons”. Which, if you think about it, it not really is a waste of time. Long story short, after couple of weeks of fiddling with the language, mostly by playing with it’s web framework I am delighted to say that it’s a really cool language that you should try out and also, I published a really small API wrapper for Elixir....

October 9, 2015 · 9 min · Ilija