Finch - HTTP client focused on performance
Finch is a new, performance-focused HTTP client that is built on Mint and NimblePool.
Reverse Engineering for Poor
Using __STACKTRACE__ and Process.info(self(), :current_stacktrace) to quickly grok the foreign code.
https://rocket-science.ru/hacking/2020/05/08/reverse-engineering-for-poor
Removing duplicates from a list in Elixir
I wrote a quick article on how to remove duplicates from a list using Enum and how to implement a version from scratch using recursion.
https://programmingzen.com/remove-duplicates-from-list-elixir/
AssertIdentity v0.1.0 released
AssertIdentity has just been released. It’s a small helper library for ExUnit that provides assertions useful for comparing data structures by identity.
AssertIdentity really shines in applications that leverage Ecto. Consider the following:
def MyApp.PostTest do
use MyApp.DataCase
test "list_posts/0 returns all posts" do
post = insert(:post)
assert Posts.list_posts() == [post]
assert_ids_match(Posts.list_posts(), [post])
end
end
The first assertion fails when using factories that, for example, insert associations. (That’s because on the left-hand side you’ll have Ecto.Association.NotLoaded for the association values but on the right-hand side you’ll have a real association struct.)
The assert_ids_match/2 assertion passes because it instead plucks the :id key from each struct and compares those values (instead of an identity comparison on the whole struct).
Check out the docs for more examples and options on how to customize the identity assertion to your needs!
Links:
Elixir: Time for Some Configuration
I wrote a blog post to help people grok the different places where to configure an Elixir application and the difference between build time and runtime. Hope it clears things up!
https://blog.nytsoi.net/2020/05/05/elixir-time-for-configuration
Cloister :: Distributed Erlang like I am 5
To avoid an enormous boilerplate in each project running distributed erlang to deal with a hostile containerized environment, helpers are to be created. Welcome Cloister, another library to erase the line between local :nonode@nohost and distributed erlang.
Manipulating INTERVALs in Ecto fragments
Querying entries that were created N days/month/weeks/years ago can be a bit tricky with Ecto but definitely a very rewarding approach to the task! In this short post we will take a look at 2 common problems with manipulating INTERVALs and understand how to circumvent them. Enjoy!
https://dev.to/lessless/manipulating-intervals-in-ecto-fragments-3ofl
A wall too tall - Nerves & k3s
The story of wanting too much, taking on more than you can comfortably handle. And probably also a cool idea. Elixir, Nerves, devops and potentially some humility.
How to protect Amazon S3 media links with Elixir and Arc
Learn how to protect 🔒 your AWS S3 files in your Elixir project using Arc, in our latest blog post 👉 https://coletiv.com/blog/how-to-protect-amazon-s3-media-links-with-elixir-and-arc/
Build a clone of airbnb using @elixirphoenix LiveView
I have been working on a video course on Phoenix Live View for sometime now.
In the course, you will be learning how to create a real world app like a clone of Airbnb using Phoenix and Live View from scratch.
More details on the table of contents, trailer video and release date will be announced in the coming weeks.
Interested? Read more here: https://io.shankardevy.com/video-courses/phoenix-live-view and subscribe to get updates.
Getting started with Phoenix LiveDashboard
Happy Monday everyone and May the 4th be with you!
Check out my latest blog post on Phoenix LiveDashboard to learn how you can go about using it in your Phoenix application :)
https://akoutmos.com/post/phoenix_live_dashboard/
Specify a Port when Booting a Phoenix Application
mix phx.server doesn’t come with a -P or -p option, so here is a quick tip on how to specify a port for your Phoenix application.
https://programmingzen.com/specify-a-port-when-booting-a-phoenix-app/
many_to_many relationships in Ecto and Phoenix for Products and Tags
A comprehensive explanation of many_to_many relationships with an example: https://minhajuddin.com/2020/05/03/many-to-many-relationships-in-ecto-and-phoenix-for-products-and-tags/
Updates of Deep Work Hours
Changelog:
- Upgrade from Phoenix 1.4 to 1.5
- Update Phoenix.PubSub implementation
- Update entries list upon insert via PubSub (thanks to video from Chris McCord)
Instrumenting Phoenix with Telemetry + LiveDashboard
LiveDashboard is here! Take a look at how to get it up and running and peek under the hood to better understand how it works together with Erlang + Elixir’s Telemetry offering. https://elixirschool.com/blog/instrumenting-phoenix-with-live-dashboard/
Local Metrics Aggregation With Counters
Recently I needed to get a better picture of how my application’s database connection pool was doing, but there was a bit of a hitch. DBConnection has a highly optimized queuing algorithm, but the downside of that optimization is that you can’t get an accurate picture of the number of idle and busy connections in the pool at any given time like you can with Poolboy. But we can use some telemetry events to get this information, with just a little bit of extra code to avoid adding a performance bottleneck to our applications!
http://devonestes.com/local-metrics-aggregation-with-counters
Developing with Elixir/OTP Course Review
I wrote a detailed review of Developing with Elixir/OTP by The Pragmatic Studio.
https://programmingzen.com/developing-with-elixir-otp-course-review/
Upgrade your use of render_existing with Phoenix 1.5
With the introduction of the new layouts in Phoenix 1.5, the traditional way of using render_existing/3 for dynamically calling render changes up a little bit. In this small post, I show you how to upgrade your use and address a common issue many of you seem to be hitting after upgrading your layouts.
https://morphic.pro/posts/upgrading-phoenix-1-5s-render-existing
Yggdrasil: Easy Pub-Sub in Elixir
Based on Phoenix.PubSub, I wrote Yggdrasil, an agnostic pub-sub library to connect different technologies under the same API.
I wrote a series of articles explaining Yggdrasil’s features:
