What happens when you compare complex data types?

While looking at what happens when you compare DateTime values using standard operators (>, <, ==, etc.), I found how Erlang and thus Elixir handles operations of complex data types. Added bonus: you’ll find out why 2 < nil in Elixir.

https://davejlong.com/2017/03/03/comparing-complex-terms-in-elixir/

Last week with Super Early Bird tickets for E&EFLBA 2017

Next Friday is the last day you can get tickets at Super Early Bird price to join Simon Thompson, Francesco Cesarini, myself and others at the first south-american Erlang & Elixir Factory ever!

Understanding Elixir's Gradual Type System

An attempt to explain the parts of Elixir’s type system that initially confused me.

https://blog.codeship.com/understanding-elixir-types/

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.

Trans 1.1.0 - Embedded translations for Elixir

Trans is a library that provides a way to manage and query translations embedded into structs and maps. This update addresses one of the main concerns of Trans since its inception: to leverage the database if available, but be usable without it.

As of version 1.1.0 Ecto is an optional dependency only required to use the query building functionality. On the other hand, the translation fetching and fallback functionality can still be used without Ecto and without a database.

https://github.com/belaustegui/trans

Phoenix and Elm, a real use case (pt. 4)

Here is part 4 of my Phoenix and Elm series, in which we cover better states with union types, search resetting, and keyed nodes.

http://codeloveandboards.com/blog/2017/02/23/phoenix-and-elm-a-real-use-case-pt-4/

Second Bors-NG nightly newsletter

Bors-NG is an autolander for GitHub. It makes sure that all the tests pass before the master branch is updated. This is the second monthly newsletter:

https://bors-ng.github.io/newsletter/2017/03/01/tmib-02/

Focus - lightweight, pure Elixir lenses

Focus is a lens library that helps you get, set, and apply functions to values at any level of a data structure.

https://travispoulsen.com/blog/posts/2017-02-19-Focus-and-Functional-Lenses.html

person = %{name: "Homer"}
nameLens = Lens.make_lens(:name)

# Extract a value from a map
Focus.view(nameLens, person) 
# "Homer"

# Replace a value in a map
Focus.set(nameLens, person, "Bart")
# %{name: "Bart"}

# Apply a function to a value in a map
Focus.over(nameLens, person, &String.upcase/1)
# %{name: "HOMER"}

Provide up-to-date information in an email sent hours ago with Elixir/Phoenix

JayPads are build for live and asynchronous collaboration and communication so it’s vital you stay up-to-date about what’s happening.

In this blog post I explain how we managed to provide up-to-date information in an email you received some time ago with the help of dynamic images and a supervised GenServer.

https:[email protected][email protected]lixir-phoenix-1b160840c879

New Pluralsight Course: Getting Started With Phoenix

My new Pluralsight course walks through building an application delivered over the web with Phoenix. It covers Models, Views, Templates, Controllers, Plugs, Sockets, and Deployment. At the end, you’ll have a working application that you can extend.

https://www.pluralsight.com/courses/phoenix-getting-started

ElixirWeekly: The Elixir Community Newsletter, covering community news you easily miss, shared on ElixirStatus and the web, in one email every Thursday.

Searching, Sorting and Pagination in Ecto & Phoenix

Rummage.Ecto and Rummage.Phoenix provide ways to perform Searching, Sorting and Pagination over Ecto queries and Phoenix collections.

For more details visit this blog

Here’s a little demo:

ExStub provides an easy way to stub a module and record the function calls executed on it.

ExStub provides an easy way to stub a module and record the function calls on it.

If you have a module in your original application like:

defmodule OriginalModule do
  def process(param), do: :original_process
  def another_method, do: :original_method
end

You can quickly create a stub copy of this module using defstub

use ExStub

defstub MyStub, for: OriginalModule do
  def process(true), do: :stubbed1
  def process(false), do: :stubbed2
  def process(1), do: :stubbed3
end

All the functions called on the defstub created module will be recorded. You can later use assert_called to check if the function was called on the stub

assert_called ModuleName.function_name

https://github.com/oarrabi/ex_stub

Rebuilding Phoenix

As part of my book on Phoenix 1.3, I have published a code repo demonstrating a minimal rebuild of Phoenix to understand various components of Phoenix, Plug, Cowboy.

For details visit Building a Slim Phoenix

Direct link to GitHub repo Slim Phoenix

The repo doesn’t have a lot of code explanations (that comes in the book). However, any curious mind can quickly go through the commit history and see what is happening.

As always, feedbacks are more than welcome

love, Shankardevy

Mix Task Creation in Elixir Project

Article on how to create mix tasks in elixir projects.

Highlights:

  1. Live demo
  2. Explanation with screenshots

https:[email protected]/mix-task-creation-in-elixir-project-d89e49267fe3#.49cfru6ql

article image

Decorating Elixir

Acutar.io blog post about how they dealed with previously calculated model fields by creating Decoratex, a library that allows to easily decorate virtual fields in Ecto models. https://medium.com/acutario/decorating-elixir-af08bd46b2fc

Domainatrex: properly parse TLDs/Domains in Elixir

Domainatrex is a TLD parsing library for Elixir, using the Public Suffix list :)

https://github.com/Zensavona/domainatrex

10 Killer Elixir Tips #2

Thanks for the great response for #1.

Here is another 10 Killer Elixir Tips #2
Happy Coding !!

https://medium.com/blackode/10-killer-elixir-tips-2-c5f87f8a70c8#.50k3xf52z

article image

Flowex 0.2.0 with 'cast' and 'error_pipe'

My talk Flowex - Flow-Based Programming with Elixir GenStage on Elixir Club 5 meetup and following discussions lead me to some significant improvements of the project.

A cast function was added to run calculation asynchronously. And an error handling mechanism was added. Since “0.2.0” each pipeline has error_pipe - separate GenStage for handling errors.

More details here: https://github.com/antonmi/flowex

Railway Oriented Programming in Elixir with Pattern Matching on Function Level and Pipelining

Coding seems cool without error checks, does not it? When if/else checks effect the next execution behaviors, then the code becomes a mess. Luckily, there is a pattern called ‘Railway Oriented Programming’ for error handling.

https:[email protected][email protected]function-level-and-pipelining-e53972cede98

A different approach to elixir test doubles

A proof of concept of a different approach to testing modules in isolation.

http://teamon.eu/2017/different-approach-to-elixir-mocks-doubles/

Create an Elixir web app using Cowboy

This post describes in detail the process of setting up Cowboy server to display a Hello World message.

https://shankardevy.github.io/code/create-elixir-web-app-using-cowboy/