Phoenix CSRF protection in HTML forms, React forms, and APIs

Let’s look on CSRF protection in Phoenix. Multi-part forms, React forms and APIs in general.

How to store username or email with case insensitive search using Ecto

A small post about case insensitive columns

Talking to the LiveView

Updating the Phoenix LiveViews from outside the process

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

Versioning v0.3.0 released!

The latest Versioning has added extensive support for Phoenix applications. Make your API future-proof by adding versioning support!

Features include:

  • An easy-to-use DSL for building a schema representing the changes across versions.
  • Simple integration with Phoenix controllers and views. Modify incoming params and outgoing data.
  • Support for multiple version types - from date to semantic. Or build your own.
  • Create a changelog based on the changes in your versioning schema.

Check it out:

Using Elixir to share data across graph databases

I just published a post today ‘Graph to graph with Elixir Moving data between semantic and property graphs’.

This post shows how we can use Elixir to move data between semantic and property graph databases, and back again. As well as the worked examples in the text, a small number of sample scripts are also provided.

Graph conversions are handled by applying simple wrapper functions over the neosemantics library from Jesús Barrasa. We also use the bolt_sips package from Florin Pătraşcu and the sparql_client package from Marcel Otto to interface respectively with Neo4j and RDF graph databases using Cypher and SPARQL, respectively.

Jeffrey Matthias from Community - Elixir in Production

We talk with Jeffrey Matthias from Community about their current and past Elixir projects and how they are deployed.

Interview: Jeremy Huffman, Dialyxir

This is my latest post for the Hashrocket blog, an interview with Jeremy Huffman, maintainer of Dialyxir.

The Elixir AST explained

Introducing the AST Ninja for helping you understand Elixir’s AST

Morphix 0.7.0 published. Now with generic morphiforming of map keys!

Morphix 0.7.0 published.

We noticed that we had some duplicated code, and that that duplicated code could be used to apply any function to recursive key transforms in maps, so we made the generic method public. Later releases will have better information about how to implement this, in the meantime, check the test examples.

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.

Hashing Files in Elixir

Hashing Files in Elixir

In this article we see what a hash function is and what it can be useful for. We see how to calculate the hash of strings and files using the Erlang :crypto module and Elixir streams.

Params modules for Phoenix

The Params modules pattern can be used in Phoenix to validate and massage a controller action’s params into data that can be passed to contexts.

ElixirMix Podcast 046 - Don’t Repeat Your Domain Knowledge with Yiming Chen

In this episode of ElixirMix, the panel talks with Yiming Chen about keeping code DRY for domain knowledge. We talk about contexts, code patterns in Ruby and Elixir, learning Elixir in China and much more!

Podcast Episode

Revisiting “Tail Call Optimization in Elixir & Erlang” with benchee 1.0

I took the release of benchee 1.0 for a spin and redid one of the first benchmarks I ever did with benchee - looking at tail call optimization in elixir and erlang to show off how benchee has improved over time. The original blog post can be found here.

Cleaning up Phoenix Controller Actions

A pattern I came across that helps when you need to pass a lot of variables to the view / template.

Implementing link following with OAuth

Link following is the process for dynamically redirecting a user after successful authentication.

I briefly detail how to implement this using the Phoenix and Ueberauth libraries.

Passing a function inside @assigns in Phoenix - Elixir

As you know, the @assigns map of connection in Phoenix is the data map of variables to be rendering in view templates. We often use this conn.assigns to store our value. But how to store a function inside this?

Jay Ashe from Cava - Elixir in Production

We talk with Jay Ashe from Cava about their current and past Elixir projects and how they are deployed.

Nightly Tasks with a GenServer

Recently on my side project Grapevine, I wanted to start shuffling up the featured games on the homepage. To do this, I set up a nightly process that does the re-ordering. This uses OTP primitives (plus Timex for time manipulating) in order to achieve this.

Elixir Orb for CircleCI

I’ve created an Elixir Orb for CircleCI. If you build projects in Elixir using CircleCI take a look into this blog post Feel free to leave any feedback and/or contribute to the orb.

Elixir Streams and large HTTP response: processing text

Elixir Streams and large HTTP responses: processing text

This is a second part of the article of last week.

This time we are going to process on the fly a 30 million lines remote file, summing the numbers of each line. We will see how to implement the functions we need to convert a stream of chunks (the one built in the part 1) to a stream of lines. We’ll then run a benchmark of two different implementations.

We will then see how easy and quick is to process just the first 30 lines of the same 125mb file.