Cool, simple macro to turn structs in agents
I wrote a simple macro that when used within a module with a struct generates a sub module that is an Agent for keeping a map of those structs. It saves me quite some time.
Feel free to use!
https://gist.github.com/roehst/1dd4ff9a2d75a7285b144ca9b7150748
How Elixir Solves a Difficult Security Problem
Thread safety issues lead to complex and high severity security bugs. Learn how Elixir’s approach to concurrency eliminates this problem.
Building a Drag-and-Drop List With LiveView and SortableJS
Add drag-and-drop functionality to your Phoenix LiveView app with SortableJS and LiveView Hooks! This posts shows you how to create an interactive list component with draggable items. Plus, you’ll discover how to use Tailwind variants in LiveView to make your draggable items look stylish. https://fly.io/phoenix-files/liveview-drag-and-drop/
HEEX special `if` and `for` attributes
I only recently learned that you can inline if
and for
statements in HEEX templates because they’re special attributes.
It can reduce the amount of tags, but it might also make your HTML harder to read. Up to you if you want to use them. 🤷
Check it out! 👉 https://youtu.be/QCHwhUIRVQw 👀
Elixir's new Unified Logger
Episode 149 of Thinking Elixir. Hauleth (Łukasz Jan Niemier) takes us deeper into the Elixir and Erlang loggers. He recently closed a 3.5 year old bug on the ElixirLang Github project by unifying the Elixir logger with the logger that Erlang got in OTP 21. We touch on the history, why it took so long, what we should think of the new logging levels, and what the original goals were that he set out to achieve. We also get an introduction to the new logging filters and handlers along with some peeks into future Erlang logging features that may still be yet to come in Elixir!
IdempotencyPlug - Idempotent POST requests
IdempotencyPlug is a plug based library that makes POST and PATCH requests idempotent using an Idempotency-Key
HTTP header.
Blog post: https://danschultzer.com/posts/idempotencyplug-idempotent-post-requests
New release: credo-language-server v0.0.3
https://twitter.com/mitchhanberg/status/1653027490779254785
credo-language-server v0.0.3 is out! #MyElixirStatus
This release, @wesleimp did us the honor of introducing our CI test suite and helped introduce the second code action! Thanks Weslei!
You can find the full release notes here: https://github.com/elixir-tools/credo-language-server/releases/tag/v0.0.3
Detecting unused database columns using Ecto schemas
I went spelunking through our production database and realised some columns weren’t referenced in our Ecto schemas, so I went and automated the discovery of unused database columns:
https://geekmonkey.org/detecting-unused-database-columns-using-ecto-schemas/
ElixirConf EU 2023, report
I wrote up my conference experience at the delightful ElixirConf EU 2023 in Lisbon.
Thanks to everyone who I talked to. It was a blast.
Hope you enjoy.
Use Heroicons the way Phoenix 1.7.2 does
👉 https://youtu.be/YLjFtMxAgIk 👀
Want to get Heroicons @elixirphoenix 1.7.2-style but have an existing app? This is what I do👇
- Update installer: mix archive.install hex phx_new
- Create sample app: mix phx.new sample
- Move vendored assets in assets/vendor/heroicons
- Replace your tailwind config with sample app’s in assets/tailwind.config.js
- Copy the icon function component from CoreComponents
- Celebrate! 🎉
Phoenix on Rails - a Phoenix course for Rails developers
PHOENIX ON RAILS is a new course that teaches Elixir and Phoenix to developers who already know Ruby on Rails.
It consists of 59 written lessons, equivalent to a 200+ page book. It explains Elixir and Phoenix from scratch in terminology that makes maximum sense to a Rails developer, relating Phoenix to the concepts you already know and making it clear where the two frameworks are similar and where they’re different.
Check it out at http://phoenixonrails.com. The course normally costs $39 - but you can use the code ELIXIRSTATUS at checkout to get $10 off. Email me at contact@phoenixonrails.com if you have any questions.
How to Build a Modal with LiveView in Phoenix 1.7
🧠 Curious about core components?
Check out “How to Build a Modal with LiveView in Phoenix 1.7” by SmartLogic Dev Bilal Hankins for info on the new component-based generators, core TailwindCSS UI components, customization with slots and attribution, and a step-by-step guide to building a modal in LiveView
Security Scanning our Apps with Sobelow
Episode 148 of Thinking Elixir. We go deeper on the Sobelow library, a security-focused static analysis tool for Elixir and Phoenix apps. We talk with Griffin Byatt, the creator, and Holden Oullette, the new maintainer. We learn how and why the project was created, how it works, what it can and can’t do, and how to use it in CI pipelines for continuous scanning. Sobelow is a cornerstone project in the community that checks a critical box for certification requirements which means we get to use Elixir when it might otherwise be a hard sell. Join us as we learn more about the project and the people behind it!
Test Data Libraries for Elixir
In the final part of our testing data with Elixir series, we’ll look at using test data libraries. https://blog.appsignal.com/2023/04/25/test-data-libraries-for-elixir.html
Elixir Security: A Guide to Fixing Sobelow Findings
Paraxial.io now provides guidance on how to fix each Sobelow finding. This documentation is open source, to benefit the Elixir community.
Big O Notation - Analyzing Time Complexity in Elixir
Big O Notation is a broad topic that can be difficult to navigate. This short guide sets out some basic rules for analyzing Time Complexity with Elixir, and introduces general categories using examples.
https://readreplica.io/big-o-notation-time-complexity-elixir/
Debugging is time-consuming and costly - Scenic QoL
When we know callbacks will be used, we can save time by adding warnings and messaging for the developer but keep flexibility by not raising exceptions. Here is one example from a pull request I put together for Scenic.
Doing Fly.io's Distributed Systems Challenges? Use maelstrom_ex, new on Hex.
I’ve been working through fly.io’s distributed systems challenge, but I didn’t want to use Go. So I built an Elixir library for talking to the Maelstrom distributed systems workbench: https://hexdocs.pm/maelstrom/Maelstrom.html.