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/
Elixir JSON 1.0 - Codename Bacon is out!
v1.0 of the first 100% native Elixir JSON library is out!
Changes include a profound reorganization of the code, and a better catch-all protocol for the encoder using Kernel.inspect.
Release Notes: https://github.com/cblage/elixir-json/releases/tag/v1.0.0
GitHub: https://github.com/cblage/elixir-json
Elixir, Erlang installation with asdf Version Manager
I needed to switch & track the multiple Elixir/Erlang versions used in different apps without losing my sanity. Did not want to install multiple managers - one for Elixir, one for Erlang and then Node.js.. So asdf Version Manager to the rescue. It manages versions for all 3 and ruby, postgres etc., Thank you @hashnuke!
I wrote down the steps to setup Elixir, Erlang and Node.js with asdf Version Manager..
https://www.icicletech.com/blog/elixir-and-erlang-setup-with-asdf-version-manager
Check it out!
Online Concentration/Memory game built with Phoenix and Elm
As a part of my getting acquainted with Elixir/Phoenix and Elm, I created this app that allows you to play the well-known Concentration (aka Memory) game over the Internet: http://pairs.one/ . It uses Phoenix channels for communication, Redis for state, supports 1-5 players and provides a few awesome visual themes. It requires no registration - just create a new game, share the URL with your opponent, and start playing. With enough interest I might open-source the code (needs a bit of clean-up) - let me know on Twitter!
Help with quality snippets
We already have 50+ nice idiomatic snippets on programming-idioms.org. Would you give a few minutes to add a playground link and/or a documentation link?
Photo Gallery from ElixirConf
We’ve added a Photo Gallery with over 90 shots from our time at Elixir and Phoenix Conf.
Adding a MAP API to a GenServer or Module with Agent-held state
I written a macro to generate wrapper functions to allow the state of a GenServer of Agent to be used with a Map API.
Intro to OTP in Elixir
A 30 minute talk I gave introducing some OTP in Elixir basics including processes, error handling, supervision trees, GenServer, and Agents. https://youtu.be/CJT8wPnmjTM
Artificial Neural Networks, Elixir, And You
The first of a new blog series about designing and building Artificial Neural Networks from scratch in Elixir. http://www.automatingthefuture.com/blog/2016/9/7/artificial-neural-networks-elixir-and-you
Insanity with Elixir, Phoenix and PostgreSQL
DISCLAIMER: This is not a “how to build a blog” article. If you do what I’m about to do, people will look at you funny (and probably should).
http://brightball.com/articles/insanity-with-elixir-phoenix-postgresql
Telegram Client
A Elixir wrapper that communicates with the Telegram-CLI. https://github.com/ccsteam/ex-telegram-client
Composable APIs with Elixir pipes
Taking lessons from Plug and Ecto let’s examine how these libraries create composable and intuitive APIs that fit well into pipe chains:
Weather
|> where(city: "Kraków")
|> order_by(:temp_lo)
|> limit(10)
|> Repo.all
Bus : simple mqtt client
Managing mqtt with your app can’t be easier than this, with that goal, i started working on mqtt client for elixir, and came up with Bus. it is usable right now, but will improve over time. please take a look and let me know what improvements can be made. thank you.
Github : https://github.com/i-m-v-j/Bus
Generate 3000 thumbnails per minute on Heroku free dyno with Elixir/OTP
Have you ever tested speed of elixir on heroku using OTP? What about 3000/minute thumbnail generation on heroku free dyno? Try creating your own instance by using heroku deploy button:
Github:https://github.com/mustafaturan/imgout
Load test results: http://bit.ly/2bYRnpp
Rails vs Phoenix: MVC
Phoenix places the controller as the center of communication. Compared to Rails, this has a couple benefits…
Recursively List Files in Elixir
Quick Elixir ditty to recursively list the files at a given path (relative or absolute):
defmodule FileExt
def ls_r(path \\ ".") do
cond do
File.regular?(path) -> [path]
File.dir?(path) ->
File.ls!(path)
|> Enum.map(&Path.join(path, &1))
|> Enum.map(&ls_r/1)
|> Enum.concat
true -> []
end
end
end
http://www.ryandaigle.com/a/recursively-list-files-in-elixir
