Phoenix 1.6 released!
We have a new version of the most popular Elixir framework - Phoenix framework!
New generators, fixes and improvements are now available. Find out more about the new HEEx engine.
How to convert string to camel and snake case in Elixir
Sooner or later you may need to convert a string in Elixir to a camel or snake case. With Macro module (available in Elixir without extra dependency) it’s super easy. https://curiosum.com/til/convert-string-to-camel-and-snake-case-elixir
Load CSS as string using JS & Webpack import prefixes
People will tell you it’s an antipattern, but what if a library needs you to do this?
https://curiosum.com/til/load-css-to-string-with-webpack-raw-loader
How to redirect back to previous page in Elixir & Phoenix?
In this post, you’ll learn how to easily redirect users to the previous path using the Navigation History plug.
It’s super easy! https://curiosum.com/til/how-to-redirect-user-back-in-elixir-phoenix
PhoenixBakery - better compression for Pheonix 1.6 assets
PhoenixBakery is library for Phoenix 1.6 (and later) that provides modules implementing Phoenix.Digester.Compressor
. There are currently 3 modules:
-
PhoenixBakery.Gzip
that replaces defaultPhoenix.Digester.Gzip
with stronger compression at cost of run time and memory usage. But as it is one-time action (for each release) it is IMHO better to use that build time for less transfer used later -
PhoenixBakery.Brotli
that provides support for Brotli algorithm designed by Google and currently supported in all modern browsers. It provides better compression thatgzip
and moderate decompression speed. -
PhoenixBakery.Zstd
that provides support for Zstandard algorithm designed by Facebook. While it is not supported by any browser (AFAIK), the support may rollout in near future. It provides slightly worse compression ratio than Brotli, but provides better decompression times.
Under the Hood of Macros in Elixir
In the second part of our metaprogramming series, find out about the inner workings of macros in Elixir.
https://blog.appsignal.com/2021/10/05/under-the-hood-of-macros-in-elixir.html
ThinkingElixir 067: Building a Healthy Community
In episode 67 of Thinking Elixir, we talk about ways we can all contribute to building a healthy Elixir community. The Elixir community is a welcoming, encouraging and helpful place and we want to help keep it that way! We talk about common problems facing maintainers, tips for engaging productively, the value of expressing appreciation, and much more!
https://thinkingelixir.com/podcast-episodes/067-building-a-healthy-community/
ThinkingElixir 067: Building a Healthy Community
In episode 67 of Thinking Elixir, we talk about ways we can all contribute to building a healthy Elixir community. The Elixir community is a welcoming, encouraging and helpful place and we want to help keep it that way! We talk about common problems facing maintainers, tips for engaging productively, the value of expressing appreciation, and much more!
https://thinkingelixir.com/podcast-episodes/067-building-a-healthy-community/
Preparing a Phoenix 1.6 app for deployment with Elixir Releases
How to prepare a Phoenix 1.6 application for deployment using Elixir Releases.
https://dev.to/miguelcoba/preparing-a-phoenix-1-6-app-for-deploying-with-elixir-releases-3gf6
Continuous Deployment to Gigalixir with GitHub Actions
Set up a continuous integration / continuous deployment (CI/CD) pipeline to automatically run your automated test on each pull request and automate deployment to Gigalixir when you push commits to your main branch.
https://staknine.com/continuous-deployment-gigalixir-github-actions/
Debug Phoenix on Gigalixir with Remote Console and Observer
Learn how to use a remote console and remote observer to debug your app in production. We can use these debugging tools to run code in production and monitor the Erlang Virtual Machine, processes, and applications remotely.
https://staknine.com/debug-phoenix-on-gigalixir-with-remote-console-and-observer/
PathGlob library released: test whether a file path matches a glob pattern, without touching the filesystem
PathGlob
tests whether a file path matches a glob pattern, without touching
the filesystem. It has the same semantics as Path.wildcard/2
.
Path.wildcard/2
allows you to find all paths that match a certain glob
pattern. If you only want to know whether a particular path matches a glob,
then Path.wildcard/2
can be slow (depending on the glob), because it needs to
traverse the filesystem.
PathGlob
provides a PathGlob.match?/3
function to check a path against a
glob without touching the filesystem. Internally, the glob pattern is compiled
to a Regex
and then checked via String.match?/2
. If you want to compile the
glob pattern ahead-of-time, you can use PathGlob.compile/2
.
More info:
Type-checking and spec-testing with TypeCheck
A guide on how to use TypeCheck and automated spectesting to make it impossible to use your functions incorrectly and reduce the amount of bugs you ship to production.
https://hexdocs.pm/type_check/type-checking-and-spec-testing-with-typecheck.html
HXL - An Elixir implementation of HCL
Happy to announce the first release of HXL an Elixir implementation of the Hashicorp Configuration Language.
Features:
- Aims to be fully compliant with the HCL spec
- Decode from string or file
- Functions and variables can be provided during evaluation
-
Config.Provider
support
Source: https://github.com/drowzy/hxl Hex: https://hex.pm/packages/hxl
hackney, version 1.18.0 has been released - Source: https://github.com/benoitc/hackney Hex: https://hex.pm/packages/hackney
Hackney 1.18.0 released Hackney is a simple HTTP client for Erlang & Elixir applications
Changes:
- security: update default CA bundle (certifi 2.8.0)
- fix pool: make checkout synchrounous (remove unwanted messages)
Source: https://github.com/benoitc/hackney Hex: https://hex.pm/packages/hackney
Enjoy!
Real-Time Form Validation with Phoenix LiveView
Discover how you can build LiveView forms that validate changes and provide real-time feedback to users.
https://blog.appsignal.com/2021/09/28/real-time-form-validations-with-phoenix-liveview.html
ThinkingElixir 066: Tracing Production with Kai Wern Choong
In episode 66 of Thinking Elixir, we talk with Kai Wern Choon about his experience tracing performance problems in production. We talk about what “tracing” means in a BEAM system, available tools like recon, great resources for learning how the tools work and general approaches for troubleshooting live production Elixir systems. Kai also shares his Livebook notebook setup for demonstrating tracing techniques in an interactive way.
https://thinkingelixir.com/podcast-episodes/066-tracing-production-with-kai-wern-choong/
Deploy livebook to fly.io using a couple clicks
Fly.io has a handy GraphQL API we can use to both create and deploy apps. This app will be deploying a livebook using only your fly auth token.
https://github.com/lubien/fly-together
Deploy Phoenix to Gigalixir using Elixir Releases
A guide on deploying your Phoenix app to Gigalixir using Elixir releases. Uses runtime config (Elixir 1.11+), automated database migrations, and esbuild (Phoenix v1.6) setup.
https://staknine.com/deploy-phoenix-to-gigalixir-using-elixir-releases/
Injecting and Discovering Dependencies in OTP Supervisors
Blogpost presents several patterns for discovering sibling processes in OTP supervisors.
https://dev.to/miros/injecting-and-discovering-dependencies-in-otp-supervisors-352m