I have started this blog a bit less than two years ago on Medium. It was a great platform to start with: there is no setup, nothing to configure, so you can start to blog in minutes.
I just wanted to share some tips about programming in Elixir. I had seen other people doing that, and the point I wanted to talk about had not been addressed by anyone else. Since then, I have published a few articles about open source libraries I’ve written and tips for tools I am using. …
Nix is a purely functional package manager that makes possible to create reproducible setups to share between developers. I have written a rather long article about it recently and I want to continue here with some specific instructions for Elixir projects in a much more concise way. I assume you know a bit about Nix in general — if it is not the case, you can read my previous article or search the web for information.
Before to look at what should go in the
shell.nix for different Elixir projects, let’s study how to make Elixir available. …
TL;DR If you don’t want to read how I’ve got to use Nix and general information about it but only focus on its use to setup a development environment, please jump to Using Nix. Even from that part, the reading can take some time as I wanted to share what I’ve learned and found useful accross two months of intensive usage. I had some initial questions I have answered to after reading a great portion of the documentation or asking to people. …
In Elixir, you can define a struct by calling
defstruct in a module. This macro takes a list of atoms which becomes the keys of the struct, or a keyword list associating these keys to default values:
defstruct name: "John Smith",
All the keys are optional by default. To enforce some of them, you must add them to
The official documentation recommends to define a type for the struct, named
TD;DR I’ve written an Elixir package to enable persistent logins through an authentication cookie, following Barry Jaspan’s Improved Persistent Login Cookie Best Practice. It is available on hex.pm and GitHub.
After writing my server-side session store using Mnesia, I found a new problem to solve: how should I manage persistent logins? One solution could be setting the session to exist forever, but this is a bad idea. If someone gets my session cookie, he can access to my account and that’s it. I have no way to discard the stolen session. I should have one. …
I am currently writing my second Phoenix application, Kakte. This is the first one with full-featured user management, so I came to ask myself how sessions are actually handled in the Elixir world. A session is a way to associate a state with an HTTP connection, so it is a pretty important feature which enables authentication and authorisation.
Before coming to Phoenix and starting to write some cool stuff, the only web technology I had played with was PHP. In its world, session information is stored server-side by default. A cookie containing a session ID is sent to the client, so that it can refer to the session on every request. So, what about Phoenix? …
TL;DR If you came here only for the technical article, please jump to the next section. If you are curious about who am I and why I start publishing here, you can continue reading this introduction.
This is my first article on medium, so I thought it would be a good idea to start it with an introduction. I will present myself, who am I, what I do, and what you can expect to appear on this blog.
My name is Jean-Philippe Cugnet. I’m a 23 years old software engineer and photographer, living in Caen, France. I just got a Master degree in IT Security at the University of Caen and I’m currently working as an embedded software developer in a design house. I also love film photography a lot, making photos from little things people may not care about. The photography story goes on my website. …