Playing With Fire

Exploring the web one Elixir at a time

Adding Elm to Phoenix

Unless you’ve been hiding under rock for the past year or so, you should be aware of Elm. If so far you have managed to miss this language/paradigm in your learning then there is no time like the present to pick it up and get familiar.

This article will present how to include Elm in your Phoenix projects so that your Elm code is intergrated into the asset pipeline and built automatically as you create a Phoenix application.


Uploading images to Heroku using Phoenix

Heroku is a natural platform to deploy Phoenix applications to. Heroku does have a small issue in that it does not allow any files to be uploaded out of the box. If you need that capability, then the uploaded file would need to be hosted on some other provider, like AWS or DigitalOcean - on Heroku there are plugins for that, or stored in a database. This post deals with hosting an uploaded image file in your application database and serving it for use in your Phoenix application.


Building a Blog with Phoenix

We’ve previously built a chat server using this Phoenix, but today I thought I would build something simple, just to show how it can be done using Phoenix. For those that are familiar with the Ruby on Rails “build a blog in under 30 minutes” tutorials, this is similar although I can’t promise that it will be that quick.


Phoenix - Building a Chat Server in 15 minutes

This post will try to show how quickly you can build a web application using Elixir and Phoenix.

For those that don’t know what Phoenix is, its a web application framework based on the MVC paradigm. In some ways its similar to Ruby on Rails (RoR). It has a similar structure, there are some generators for common code. Unlike RoR, Phoenix is fast - really fast and extremely stable The Road to 2 Million Websocket Connections in Phoenix.


Dealing with collections - Enum (and Stream)

The Enum module is one of the main workhorses in your Elixir armoury. This module collects together all the various functions that operate on list (or recursive) structures, or rather Enumerables. If you need a refresher on lists then read the post found here. There is also pretty good information available on the Elixir website - Enumerables and Streams.

The Enum module provides a large amount of functionality which allows us to map, filter, fold, transform and sort any given enumerable - more than we will have space to cover, so we will the most important.


Control your flow

There are several ways in Elixir to control which path through your application is followed based on the data that is provided or the structure/type of the data structure that is being used.

Firstly, we will start with a recap on pattern-matching, then progressing on to guards and then cover the conditional expressions: case, cond and if/else.



eWebmachine 2 - Hello World

Ewebmachine 2 has now been out a little while. This version is a complete rewrite of the project that breaks backward compatibility. Ewebmachine 1 was a wrapper around basho webmachine, whereas Ewebmachine is now a full re-implementation using a new DSL and Plugs.

Because it is different, I thought that I would create a simple HelloWorld just to explore the changes…