My Elixir Diary

Just started learning #elixir and plan to share my daily experience learning it.

Let's Build Something: Elixir, Part 6 - Adding Metrics to StatsYard

Adding some basic metrics to our project with Statix, Folsom, and Ex_VMStats.

Elixir vs Ruby: Naming conventions

How does naming files, modules, variables and functions in Elixir compare to Ruby and its convention-driven world?

Read more at Phoenix on Rails blog.

Shameless plug: Check out @elixirstatus' other community project:

Credo, a new static code analysis tool that acts as a code linter, but also focusses on teaching coding practices and code consistency. OAuth2 Strategy for Überauth

I am happy to introduce an authorization backend for the russian largest social network:

Project’s page:

Made for the awesome ueberauth project:

Kerosene Pagination for ecto and phoenix

I am very happy to release a newer version of my pagination library, check it out on github

New version of the 'Sequences' library

I’ve updated the Sequences library, that lazily computes sequences of useful mathematical numbers for you, like Fibonacchi, the Factorials, the Catalan numbers, and the Primes.

Now, it will also happily generate digits of pi for you, as well as some other small things.

I look forward to any feedback!

Swoosh v0.4 released

Swoosh 0.4 is out today. Highlights from this release:

  • Sendmail adapter.
  • DKIM support for the SMTP and Sendmail adapter.
  • New deliver!/2 variant of deliver/2.
  • Basic integration testing for the library itself. We are now making real calls to the various providers’ API during testing (except Mandrill as they no longer have a free plan).

Check the full changelog for more details.

Open an issue or grab me on Slack/IRC if you run into any issue with this release.

Swappy: a fast, customizable anagram generator

I, AKA a ham wrestling mixer!… Wait, I mean “make anagrams with Elixir!”

Swappy is a fast, customizable anagram generation library. You can use it at the command line via mix generate_anagrams, or use it in your own module to, eg, generate anagrams in response to web requests.

Enjoy! :D

Tail Call Optimization in Elixir & Erlang – not as efficient and important as you probably think

I wrote a blog post about the performance of tail-recursive and body-recursive functions in Elixir and Erlang (spoiler alert: body-recursive can be faster!). You might have seen this post before (published a week ago) - but it has since gone through 9 updates including insightful comments from Robert Virding (co-creator of Erlang) and José Valim as well as a new faster tail-recursive implementation. So it might be worth checking out again.

gen_state_machine v1.0.0 released: an Elixir wrapper for OTP 19's gen_statem

OTP 19 is a big step forward for both Erlang and Elixir developers. One exciting new feature is gen_statem, a state machine behavior. State machines are incredibly versatile, and can be used to implement many types of functionality, including network protocols, trading systems, and compilers.

To celebrate the release of OTP 19 this week, I’ve just released v1.0.0 of my fully-documented and community-reviewed Elixir wrapper for gen_statem, gen_state_machine. You can now use gen_statem in your production Elixir apps through an idiomatic Elixir interface!

Check out the documentation for an example of how you can use gen_state_machine in your apps, and you can find the project on GitHub here.

If you’re interested in learning more about gen_statem and gen_state_machine, please join me at Elixir Camp NYC from July 15-17 for my session, “Stately Machines: OTP 19, Elixir, and gen_statem.”

Property Based Testing in Elixir

An introduction to QuickCheck-style property based testing and a walkthrough demonstrating how to use properties to test a quicksort implementation.

Family Ties Part 8 posted, discussing module attributes and the preprocessor

Posted the eighth of a continuing series of articles on similarities and differences between Erlang and Elixir. This is the first of two articles covering the Erlang preprocessor and its relationship with Elixir features.

Index of previous articles in the series:

Composing and mixing Phoenix plugs

Plugs make a serial routing chain, but it’s very easy to mix them arbitrarily. Here’s a cool backdoor example how.

Read more at Phoenix on Rails blog.

Use Elixir in CodeRunner 2

I love to tinker with code snippets in CodeRunner 2 on the Mac as a way to learn and experiment. CodeRunner is a hybrid of a text editor and the Terminal wrapped in a nice GUI. Using Elixir in CodeRunner is easily accomplished as explained in my blog post:

Use Elixir in CodeRunner 2

Credo v0.4.5 released

Credo has received an update today:

  • Warnings about redeclaring names of Kernel or local functions now only consider functions with arity zero.
  • Warnings for operations with constant result now ignore division by 1
  • New check: readability/parentheses_in_condition


Bonus: You now get more detailed information on how to configure individual checks:

Use Natural Language Processing in Elixir for bots

When creating bots you have to converse with the users and maintain context of the conversation so you can understand the intent of the users, do the necessary actions. In this tutorial we will see how to use to create conversational models and use them in Elixir.


Cachex v1.2.0 Released! Changelog:

Cachex v1.2.0 has been released with a rough 3x speedup over previous versions. Naturally it’s backwards compatible due to being release on a minor, so feel free to update and give it a go!

CredoCI - A service to check your github PRs with Credo

Some time ago we started developing using Elixir language and we loved it! As usual, we wanted to focus on code logic rather than on code style, so we also started using Credo a great tool to examine elixir code developed by René Föhring (@rrrene) So far so good, but we all make mistakes, and sometimes developers send a pull request without fixing all credo warnings/errors. A few times of this happening was enough proof to consider that we needed a tool to automatically check the code whenever a pull request was created.

We know this type of tools already exist for other languages (Gadget, Hounci), but unfortunately, we did not find one for credo/elixir. As always, if we don’t find something we need, we build it!

So that’s how CredoCI was born. Want to know more about it? Check this out

Streaming video with Phoenix

A simple tutorial about streaming video using Phoenix

Build a Reverse Proxy in Phoenix

Getting Elixir into production on an existing project is not always easy. I decided to build a reverse-proxy API in Elixir / Phoenix so that your current production API routes can be moved into Elixir one by one.

Replace Your Production API With Elixir Today