Elixir Application teardown - User Profile API for the Rio 2016 Olympics
In this article, I wrote the teardown for the first article version of Elixir Video User Profile Service for the Rio 2016 Olympics
Exgen: A templating library for reusable Elixir apps
Do you have certain classes of applications you frequently create, or have a bunch of standard setup you automatically include in every new project? Exgen was built to address this need - a way to quickly generate projects from a base template.
https://github.com/rwdaigle/exgen
Commensurate with Exgen is the hope that the community will share their templates, their approaches to solving common problems, so that others can benefit and quickly get up and running themselves.
Exgen is in early development, so all feedback is welcome.
PlugRest is a new library for hypermedia web apps
PlugRest is an Elixir port of Cowboy’s REST sub-protocol for Plug and Phoenix applications. It features router macros, a resource behaviour, and a REST state machine.
PlugRest is perfect for creating well-behaved and semantically correct hypermedia web applications in Elixir.
IoT with Elixir and CoAP part 2: How to easily prototype and build an IoT platform
We are back with the second part of our IoT development series where we use Elixir to create a simple IoT setup talking over the Constrained Application Protocol (CoAP).
Requiring Sign In in Phoenix
Coming from Rails, there are a lot of little things to learn about Phoenix to write a fully functional app. To help others make the same transition, I wrote a blog post explaining how to use plug in a Phoenix application to require a user be signed in for certain actions.
Building a Digital Goods Shop & Blog in Elixir
I have just open sourced my first Elixir/Phoenix application. It is a simple CMS to manage my online shop and blog - Authentic Pixels.
This project has been a great learning experience for me. Coming from Ruby on Rails, there are a lot of things that are done differently in Elixir/Phoenix and building this app has helped me understand the “Elixir way” of doing things.
Some of the things that this project helped me wrap my head around are -
- Nested records & associations (e.g: Product has many variants)
- Handling many-to-many associations and validating them
- Uploading images
- Testing
- Switching to Webpack from Brunch
- Creating Sitemaps and running a cron task to regularly run the sitemap generation task
- Deploying (to a Digital Ocean box using Dokku)
- Sending HTML emails.
- Separating admin area from frontend using differnt layouts and scopes in router.ex
I will be writing about this is a lot more detail on my blog soon.
Do review the code and let me know your thoughts/critiques - https://github.com/authentic-pixels/ex-shop
Building a Casino in Elixir
So obviously we can’t build an actual working Casino in a single tutorial. Instead we’re going to focus on building out a supervision tree using the components of Elixir.
First up we need a way to register new players in the casino. Each player should have a name, a balance, and the ability to deposit money and make bets. We will need to supervise the players to keep the register up-to-date as players come and go.
Second we will build out the blackjack tables of the casino. We need a way of automatically generating the initial tables when the casino first opens, but we also need to add and remove tables as the demand fluctuates.
And of course, we need to build this Elixir application to deal with failure. If something goes wrong in one of the branches or leaves of the tree, we should be able to recover without disrupting the rest of the application.
LDAP authentication with Phoenix
LDAP is mostly used by medium-to-large organizations to have one centralized place to store users and groups and to allow others internal systems to authenticate the users. If you want to build Phoenix applications that will work within an enterprise you will likely have to integrate with an existing LDAP server.
In this article I’m going to show you how you can authenticate and synchronize users to your Phoenix application.
http://rny.io/elixir/phoenix/ldap/2016/09/20/ldap-authenication-with-phoenix.html
The Adventures of Generating Random Numbers in Erlang and Elixir
While working in Elixir I needed to generate a random number and to my surprise could not find an easy way to do so without using Erlang (at first - see below). That lead me to learning a few interesting things about random seeds, how to create secure ones and how Erlang handles random.
arcgis_geocode - a client library for the ArcGIS Geocoding APIs
I published my first Elixir Hex package this week and would love some community feedback. Any and all comments, suggestions, and criticisms are welcome. The package is a client library for Geocoding addresses and uses ETS to cache the API authentication token to avoid authenticating each and every request. I’m still new to OTP and FP in general but this has been tons of fun to work on.
Dumballah - Manipulate Unix timestamps easily
Dumballah is a tiny library that provides conversions between seconds and other time units, and some useful calculations to make easier the manipulation of Unix timestamps.
It was also my project to learn about CI, tests and inline documentation in Elixir.
(Dumballah is the name of a Loa in the voodoo cult.)
Is Elixir programming really that hard?
How to survive in a post-apocalyptic Elixir world devoid of classes, objects and methods that we’ve grown to depend on so much?
Read more on Phoenix on Rails blog.
HTTPipe - Composable, Adapter Driven HTTP Requests
Just released the initial version of HTTPipe and looking for community feedback before I do a 1.0 release. The intent is making HTTP requests easier to design by encapsulating the entire connection in a struct, so a request can be built up in a composable, flowing manner and then executed.
It’s also adapter driven, so even if you build an API library, if someone else wants to use ibrowse with your library instead of hackney, it’s painless to switch out. (Currently I’ve only written a hackney adapter, though, so if you want to use ibrowse you’ll need to write one).
The beauty of being adapter driven means you can easily create a test-only adapter that returns test data instead of connecting to a remote server.
I’m very interested in hearing what works for people, what doesn’t work, and what’s needed to make it useful.
Pattern Macthing to Polymorphism - an Unexpected Journey
When I started learning Elixir I didn’t really appreciate the power of pattern matching.
Little did I expect my use of pattern matching for functions would end up as a form of runtime polymorphism.
IntelliJ Elixir v4.4.0
Alias completion inside { } used for alias Prefix.{…}, import Prefix.{…}, etc.
Bringing one of my favorite Elixir features to Swift
A quick experiment I did trying to bring the piping syntax from Elixir to Swift.
This is an old article that I just decided to publish. It was a lot of fun to write.
Benchee 0.4.0 released – adjust what is printed
I made a new release of my Elixir benchmarking library benchee. This release focusses on making some output configurable so that you can omit comparisons and warnings.
You can find a high level overview on my blog and as always the changelog has all the details.
Also: what’s next for benchee? I’m really working on an HTML formatter that gives you nice looking graphs, but shhh still secret ;)
Introducing PolicyWonk - Elixir/Phoenix Authorization Library
PolicyWonk is a lightweight authorization and resource loading library for any Plug or Phoenix application. Authorization (Auth-Z) is the process of deciding what a user/entity is allowed to do after they’ve been authenticated.
PolicyWonk provides three main plugs.
-
PolicyWonk.LoadResourceloads resources into the conn’s assigns map. -
PolicyWonk.Enforceevaluates a specified policy. It either continues or halts the plug chain depending on the policy result. -
PolicyWonk.EnforceActionevaluates a policy for each incoming controller action in Phoenix.
Decisions are made before controller actions are called, isolating authorization logic, encouraging policy re-use, and reducing the odds of messing Auth-Z up as you develop your controllers.
In a router:
pipeline :browser_session do
plug PolicyWonk.LoadResource, :current_user
plug PolicyWonk.Enforce, :current_user
end
pipeline :admin do
plug PolicyWonk.Enforce, {:user_permission, "admin"}
end
In a controller:
plug PolicyWonk.Enforce, {:user_permission, "admin_content"}
plug PolicyWonk.EnforceAction
Check it out here:
Actors vs Objects
I wrote a blog post outlining the difference between actors and objects: https://anthonylebrun.silvrback.com/actors-vs-objects
The Elixir way: Operational reasoning
Wrote a blog based on inspiration I got from James Edward Gray II. It’s about looking at a project with a mind toward OTP, which takes some getting used to.
blog: http://blog.mojotech.com/the-elixir-way-operational-reasoning/
