Fight Poverty & Hunger w/ Elixir/Phoenix!
Phoenix app to help manage healthy food choices for pantry programs https://github.com/MasbiaSoupKitchenNetwork/open_pantry Early stages but welcome contributors or connections to food programs that might benefit!
action_fallback and contexts in Phoenix 1.3 made my controllers tiny!
I’m amazed by how much cleaner my code is now that I’m using contexts and action_fallback on Phoenix 1.3, so I wrote a bit about it today.
Read here: http://swanros.com/action-fallback-contexts-phoenix1-3-tiny-controllers/
Elixir State Management: Agent or GenServer?
A look at two of the common state management tools in Elixir. http://awochna.com/2017/03/03/elixir-state-management.html
Phoenix 1.3 is pure love for API development
I wrote a bit about the changes that I love about Phoenix 1.3 and why I think this is a great release for API projects.
Read here: http://swanros.com/phoenix-1-3-is-pure-love-for-api-development/
What happens when you compare complex data types?
While looking at what happens when you compare DateTime values using standard operators (>, <, ==, etc.), I found how Erlang and thus Elixir handles operations of complex data types. Added bonus: you’ll find out why 2 < nil in Elixir.
https://davejlong.com/2017/03/03/comparing-complex-terms-in-elixir/
Last week with Super Early Bird tickets for E&EFLBA 2017
Next Friday is the last day you can get tickets at Super Early Bird price to join Simon Thompson, Francesco Cesarini, myself and others at the first south-american Erlang & Elixir Factory ever!
Understanding Elixir's Gradual Type System
An attempt to explain the parts of Elixir’s type system that initially confused me.
Trans 1.1.0 - Embedded translations for Elixir
Trans is a library that provides a way to manage and query translations embedded into structs and maps. This update addresses one of the main concerns of Trans since its inception: to leverage the database if available, but be usable without it.
As of version 1.1.0 Ecto is an optional dependency only required to use the query building functionality. On the other hand, the translation fetching and fallback functionality can still be used without Ecto and without a database.
Phoenix and Elm, a real use case (pt. 4)
Here is part 4 of my Phoenix and Elm series, in which we cover better states with union types, search resetting, and keyed nodes.
http://codeloveandboards.com/blog/2017/02/23/phoenix-and-elm-a-real-use-case-pt-4/
Focus - lightweight, pure Elixir lenses
Focus is a lens library that helps you get, set, and apply functions to values at any level of a data structure.
https://travispoulsen.com/blog/posts/2017-02-19-Focus-and-Functional-Lenses.html
person = %{name: "Homer"}
nameLens = Lens.make_lens(:name)
# Extract a value from a map
Focus.view(nameLens, person)
# "Homer"
# Replace a value in a map
Focus.set(nameLens, person, "Bart")
# %{name: "Bart"}
# Apply a function to a value in a map
Focus.over(nameLens, person, &String.upcase/1)
# %{name: "HOMER"}
Provide up-to-date information in an email sent hours ago with Elixir/Phoenix
JayPads are build for live and asynchronous collaboration and communication so it’s vital you stay up-to-date about what’s happening.
In this blog post I explain how we managed to provide up-to-date information in an email you received some time ago with the help of dynamic images and a supervised GenServer.
New Pluralsight Course: Getting Started With Phoenix
My new Pluralsight course walks through building an application delivered over the web with Phoenix. It covers Models, Views, Templates, Controllers, Plugs, Sockets, and Deployment. At the end, you’ll have a working application that you can extend.
Searching, Sorting and Pagination in Ecto & Phoenix
Rummage.Ecto and Rummage.Phoenix provide ways to perform Searching, Sorting and Pagination over Ecto queries and Phoenix collections.
For more details visit this blog
Here’s a little demo:
ExStub provides an easy way to stub a module and record the function calls executed on it.
ExStub provides an easy way to stub a module and record the function calls on it.
If you have a module in your original application like:
defmodule OriginalModule do
def process(param), do: :original_process
def another_method, do: :original_method
end
You can quickly create a stub copy of this module using defstub
use ExStub
defstub MyStub, for: OriginalModule do
def process(true), do: :stubbed1
def process(false), do: :stubbed2
def process(1), do: :stubbed3
end
All the functions called on the defstub created module will be recorded.
You can later use assert_called to check if the function was called on the stub
assert_called ModuleName.function_name
Rebuilding Phoenix
As part of my book on Phoenix 1.3, I have published a code repo demonstrating a minimal rebuild of Phoenix to understand various components of Phoenix, Plug, Cowboy.
For details visit Building a Slim Phoenix
Direct link to GitHub repo Slim Phoenix
The repo doesn’t have a lot of code explanations (that comes in the book). However, any curious mind can quickly go through the commit history and see what is happening.
As always, feedbacks are more than welcome
love, Shankardevy
Mix Task Creation in Elixir Project
Article on how to create mix tasks in elixir projects.
Highlights:
- Live demo
- Explanation with screenshots
https://medium.com/@blackode/mix-task-creation-in-elixir-project-d89e49267fe3#.49cfru6ql
Decorating Elixir
Acutar.io blog post about how they dealed with previously calculated model fields by creating Decoratex, a library that allows to easily decorate virtual fields in Ecto models. https://medium.com/acutario/decorating-elixir-af08bd46b2fc
Domainatrex: properly parse TLDs/Domains in Elixir
Domainatrex is a TLD parsing library for Elixir, using the Public Suffix list :)
10 Killer Elixir Tips #2
Thanks for the great response for #1.
Here is another 10 Killer Elixir Tips #2
Happy Coding !!
https://medium.com/blackode/10-killer-elixir-tips-2-c5f87f8a70c8#.50k3xf52z
Flowex 0.2.0 with 'cast' and 'error_pipe'
My talk Flowex - Flow-Based Programming with Elixir GenStage on Elixir Club 5 meetup and following discussions lead me to some significant improvements of the project.
A cast function was added to run calculation asynchronously. And an error handling mechanism was added. Since “0.2.0” each pipeline has error_pipe - separate GenStage for handling errors.
More details here: https://github.com/antonmi/flowex
