Rails, Secure Cookies, HSTS and friends

Ruby on Rails as a framework does a lot of things for us developers. We get a very customizable middleware stack, great routing system, very expressive ORM, helpful modules with great utility methods in them and so on. But in Rails there’s more than meets the eye. It does some great things that we just take for granted or on occasions we don’t even know they exist.

More …

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.

More …

Testing Ruby Mixins with Minitest in isolation

Mixins in Ruby are a very powerful feature. But knowing how to test them sometimes is not so obvious, especially to beginners. I think that this comes from mixins’ nature - they get mixed into other classes. So, if you think that there is a lot to testing mixins and you easily get overwhelmed by it - take it easy, it’s not that hard.

More …

Expressing intent via pattern matching

Pattern matching. It’s Elixir’s one of the most simple yet powerful features. Most of us, at least at the beginning of the Elixir journey, think of it as assignment. And we discover it is not assigment and yet we still use it as one. But, pattern matching is (and can be) much more than binding a value to a variable.

More …

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.

More …

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.

More …

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.

More …

Elixir through Ruby-tinted glasses: pattern matching

Elixir has become the new hotness. And I think it’s for a good reason. It’s a functional language, it’s fast and it really looks like Ruby. To some people the way the language “looks” shouldn’t be much of a factor. But as a Ruby programmer I’ve become very attracted by a language’s syntax. Ruby’s syntax is awesome and I wouldn’t want to learn a language with a hard-to-swallow syntax.

More …