Thinking Elixir 161: Lexical LS and Elixir Dev UX
Episode 161 of Thinking Elixir. Language Servers underpin the language specific support we rely on in modern code editors. Lately, there have been new efforts in this area in the Elixir community. We talk with Steve Cohen about his project Lexical LS to learn about his new Elixir Language Server, how long he’s been at it, and what it can do today. We learn about some of the technical challenges when creating a tool like this, and why there’s still room for new projects in this area. Steve explains how Lexical LS is architected and that it is a goal to be easy to contribute to and work on the Lexical project itself. Time to give it a try!
A Breakdown of HTTP Clients in Elixir by Andrea Leopardi
Andrea Leopardi (@whatyouhide) breaks down the HTTP clients in Elixir! I personally reach for Finch but I’ve been hearing a lot about Req. Find out the difference and then some! https://andrealeopardi.com/posts/breakdown-of-http-clients-in-elixir/
DoIt - Elixir Command Line Interface Framework
With DoIt you can generate nice CLI tools in Elixir. You have two ways two package your CLI:
- escript: Generate an executable to run in any machine that has Erlang/OTP installed.
- burrito-elixir: Generate a single binary with all dependencies.
Paraxial.io case study series
This is our first case study in a series of exploring a real-world usage of the Elixir.
Read it here: https://curiosum.com/blog/paraxial-elixir-case-study
Paraxial.io case study series
This is our first case study in a series of exploring a real-world usage of the Elixir.
Read it here: https://curiosum.com/blog/paraxial-elixir-case-study
Elixir is (Still) Safe
A recently published paper makes some misleading claims about Elixir security. How do they hold up?
Elixir for Ruby developers: the three most important differences
Many developers who learn Elixir come from a background in Ruby. This is hardly surprising: Elixir’s creator, José Valim, was formerly a prominent Ruby developer, and Elixir has been attracting Rubyists since the very beginning!
But while Elixir’s syntax looks like Ruby at a glance, you’ll quickly realise that these similarities are skin-deep. The two languages are very different in their underlying designs, and Elixir often requires you to structure your code in a way that looks nothing like the equivalent Ruby. Certain aspects of Elixir will feel very unfamiliar to a Rubyist, and will take some getting used to.
This series will give a brief introduction to Elixir for developers who already know Ruby. But before we get into the details of Elixir’s syntax, it’s worth reviewing some of the higher-level differences between the two languages. In particular, here are the three most important differences between Elixir and Ruby:
https://phoenixonrails.com/blog/elixir-for-ruby-developers-the-three-most-important-differences
Autocontext: Lets DRY your Ecto contexts.
Yeah, for some, this could be an Ecto’s heresy, but I’ve built a lib that provides ActiveRecord-like callbacks, simplifying database operations management. This includes [before | after]_save
, [before | after]_create
, [before | after]_update
, and [before | after]_delete
functions.
Also, thanks to the Elixir community I have also added some configurability that is (yet) inaudit on ActiveRecord land. This is:
- Support for optional transactions on the operation. Behind the scenes the operation is wrapped in a Ecto.Multi
-
Support for multiple configurations that may involve different Changesets over a Single Schema or even different Changesets over different Schemas.
Example:
This is Just a way to abstract the functions you would write anyway on your contexts, Behind the scenes it uses the typical Ecto calls, it just saves writing and repeating the same code every time. Imo having to write the same every time does not make sense. Of course for the 1% of the times when it does you can overwrite the functions at your will.
Make your Ecto contexts fun! https://github.com/michelson/autocontext
Creating infinite sequences with Stream.unfold/2
Want to learn how to create infinite sequences in Elixir?
We can do it with Stream.unfold/2
🤯
Check out how we use it to generate a finite sequence, an infinite sequence, and the Fibonacci sequence. 😊
🎥 https://elixirstreams.com/tips/creating-infinite-sequences-with-unfold
Library authors hate this one weird trick!
I think my head hit the keyboard when I learned how much time I had wasted when debugging Elixir dependencies.
No more mucking with path deps or its ilk. mix deps.compile is your friend! See more at:
SQL Injections vs Elixir
Let’s keep building safe, robust applications with Elixir. Happy coding! 🚀🔒 Take a moment to read it here: https://curiosum.com/blog/sql-injections-vs-elixir
#Elixir #WebSecurity #SQLInjection
Turn maps (and keyword lists) into structs
One nice way of turning a map or keyword list into an existing struct is to use struct/2
or struct!/2
.
What about attributes that aren’t defined in the struct?
-
struct/2
will drop them 👋 -
struct!/2
will raise an error 💥
Check it out! 👀
👉 https://www.elixirstreams.com/tips/turn-maps-into-structs-with-struct
Thinking Elixir 160: LiveView Async Pattern and Admin Tools
Episode 160 of Thinking Elixir. After experience with a LiveView “anti-pattern”, Andy Glassman developed an “Async Pattern” for loading data into a LiveView. Andy shares the problem this helps solve and we discuss when it’s a good fit. We also talk with Andy about the current state of “admin tools” in Elixir and he shares his feelings on the importance of building admin tools from the start in our projects.
Observe Your Phoenix App with Structured Logging
Let’s configure a Phoenix LiveView application to use a structured logger and monitor the app with AppSignal: https://blog.appsignal.com/2023/07/18/observe-your-phoenix-app-with-structured-logging.html
Instilling a passion for functional programming in developers - Elixir Meetup #19
It’s for those who are interested in becoming a better programmer, who has a better and more clear understanding of not only functional programming but programming in general.
Check the Mikołaj Kubera presentation: https://www.youtube.com/watch?v=ZL4gH2WwcBw
Testing Timer-based Logic in Elixir with Klotho Library
We introduce an approach to testing time- and timer- based logic in Elixir with an unburdensome variant of dependency injection https://dev.to/savonarola/testing-timer-based-logic-in-elixir-with-klotho-library-2c90
Implementing an NTP server in Elixir
In this post we go thru a simple Network Time Protocol server implementation in Elixir. While the end product is not production ready we learn a lot about UDP, sniffing traffic, GenServers, bitstrings, sigils, and other cool tricks.
What's new in Livebook 0.10 - Introducing Multi-Session Livebook Apps
Livebook 0.10 was released! 🎉
The main new feature is Multi-Session Livebook Apps. You can think of them as something similar to scripts, but instead of running in a terminal, they are interactive web applications accessed through the browser.
The other new features are:
- Presentation View
- Initial Erlang Support
- Live Doctests
- Dataframe File Export
Announcement blog post: https://news.livebook.dev/whats-new-in-livebook-0.10—introducing-multi-session-livebook-apps-3Dbpss
Full changelog: https://github.com/livebook-dev/livebook/blob/v0.10/CHANGELOG.md
Adjustments of Phoenix application configuration
Rearrange Phoenixʼ config files to improve their developer experience!
https://bitcrowd.dev/two-small-adjustments-of-phoenix-application-configuration
Elixir Fortaleza Conf 2023
An event organized by the Elixir community. Dates: September 21st and 22st, 2023 Location: Fortaleza, Ceará, Brazil. Stay tuned for more information at https://elixiremfoco.com/elixirfortalezaen