Petal Components - ElixirCasts
In this episode, we’ll learn how to use Petal Components in a Phoenix application.
The Comprehensive Guide to Elixir's List Comprehension
List comprehensions are one of my favorite features of Elixir and I am excited to finally be writing about them! In the article I go over every single feature and option of the comprehension, how to use them, and how they compare to Enum and recursive functions.
https://www.mitchellhanberg.com/the-comprehensive-guide-to-elixirs-for-comprehension/
IntelliJ Elixir v13.1.0
Changelog
v13.1.0
Enhancements
-
New Project > Language > Elixir includes all mix options
-
–app -
–module -
–sup -
–umbrella
-
-
Add
mix formatexternal formatter. Requires project or module SDK be set in order to run. If the SDK is not available, only the internal formatter will be used. The internal formatter is still used for file subsection formatting and new line indenting asmix formatworks at the file-level.-
Allow
mix formatexternal formatter to be disabled.- Preferences
- Editor > Code Style > Elixir
-
Click the
mix formattab - Expand the General group
-
Uncheck “Format files with
mix format“.
-
Allow
-
Support Elixir 1.13.0 in debugger.
Bug Fixes
-
Look above
CallDefinitionImplforTypescope processing It should go up to theModuleImplto find theTypeDefinitionImpl. -
Have Credo Global Inspection use standard
Mix.commandLineused for Run Configurations.- Allow environment variables to be set similar to Run Configurations for projects that require environment variables to be set for Mix tasks due to checks in their config.
- No longer support Include Explanations as it takes too long to run.
- Remove annotator until it can be re-implemented in performant manner using corrected environment and SDK from Global Inspection.
-
Fix Find Usages that resolve to compiled types.
-
Add element description for
TypeDefinitionImpl-
Node Text is
@<module_attribte> <name>(<parameters>) :: … -
Long Name and Short Name are just the
name -
Type is
type
-
Node Text is
-
Mirror
TypeDefinitionImplsto types in decompiled source. AllowTypeDefinitionImpl.getNavigationto go to decompiled types.
-
Add element description for
- Allow types with atom keyword names to be highlight even though they are invalid names.
-
Restore Project configuration for Small IDEs.
I dropped an
!when converting fromequalsto==when fixing the deprecation warnings, which made the Project SDK selection only be HIDDEN where it needed to be SHOWN. -
Catch
StackOverflowErrorinfind_usages.Provider.getType(). -
Element descriptions for
CallDefinitionImpl -
Highlight
CallDefinitionImplreferences as predefined if resolvedCallDefinitionImplis inKernelorKernel.SpecialForms. Fixes highlightingdefand other defined when using SDKs without source like Homebrew after the delayed-decompilation fixes from 12.2.1. Now source-less (Homebrew) and SDKs with sources (ASDF) will both be able to highlight predefineds. -
No longer record the SDK name as an attribute of the Facet configuration, as it didn’t write back changes.
- Instead detect the Elixir SDK by finding any of the libraries that have an Elixir SDK name in the module. (The Elixir SDK was already being added as a library to allow indexing the SDK.)
- Clear out any existing Elixir SDKs listed as module libraries before setting a new SDK. This eliminates the duplicates that happened before. (It turns out the JetBrains API doesn’t prevent duplicates. Oopsie.) It also ensures that no SDK is recorded if the SDK is deselected in the UI, which wouldn’t happen before.
-
In IntelliJ 2022, the New Project dialog changed and it no longer automatically listed
ModuleType.getBuilderModuleBuilders as potential project builders, so it looked like Elixir New Project support disappeared. Fix this by implementing thenewProjectWizard.languageextension that was added to control the Language switching in the new New Project dialog. -
Remove references to
ElementClassHintin BeamFileImpl that only work in IntelliJ.ElementClassHintis part of theprocessDeclarationsystem used in Java and so was in the code becauseBeamFileImplwas original based onClassFileImpl, but since the Elixir resolvers don’t use the hint system at all, it can just be removed. -
Fix environment not being passed to debug runs of ESpec and ExUnit Run Configurations.
The
envfrom theConfigurationwas dropped because a localenvwas created to setMIX_ENVtrue.
🎉 Announcing the Paraxial.io Beta Launch!
Paraxial.io protects your Elixir/Phoenix application from bots attempting automated logins, scraping, and disruption of service. Today we are happy to announce the beta program is open to new users!
To sign up, email support@paraxial.io with a brief description of your website. The beta is open to anyone with an Elixir/Phoenix application, from a personal project to larger corporate site.
ThinkingElixir 101: Replicating SQLite using Litestream with Ben Johnson
In episode 101 of Thinking Elixir, Ben Johnson explains his project Litestream.io, an OpenSource tool that replicates SQLite databases to remote servers and to backup locations like S3 for durability. We talk about how moving data out to the user creates true edge applications. We discuss what types of problems this helps solve, the architectures that become possible, and how a globally distributed Phoenix application could use this. He shares how Fly.io acquired the project and brought him on full-time to continue his work on it. Fascinating discussion that challenges many of the assumptions about how we’ve been building “web” systems for years.
Algebraic Data Types in Elixir
Discover the ins and outs of ADTs and their benefits for your Elixir app. https://blog.appsignal.com/2022/05/31/algebraic-data-types-in-elixir.html
TIL: Temporary data folder
The temporary directory for data storage is often used. However, /tmp dir is not always a good solution. Depending on the configuration, it can be represented differently. Check how you can fix it with simple modification.
ExMarcel: A Library for MIME type detection based on magic numbers
Marcel attempts to choose the most appropriate content type for a given file by looking at the binary data, the filename, and any declared type. This package is a port of Rails’s Marcel library. https://github.com/chaskiq/ex-marcel
Boost your test coverage with Elixir
In this article, I will help you build the appropriate tooling to track and measure your test coverage, and hopefully improve it.
https://www.christianblavier.com/boost-your-test-coverage-with-elixir/
Elixir Meetup #6 hosted by Curiosum
Elixir Meetup #6 on June 8, 2022 at 18 CET
Where? 👉 ONLINE & FREE
Register 👉👉 https://curiosum.com/meetups/elixir
🔥 Speakers 🔥
- Gustavo Oliveira - Use TDD step by step with live view
- Adolfo Neto - Learning Erlang and Elixir through exercises and the advent of code
Simple Dependency Injection in ExUnit
Smart testing strategies for Elixir with Dependency Injection design pattern: https://k.lelonek.me/simple-di-in-elixir
Conference report: Code BEAM, Stockholm 2022
I wrote up my experience at Code BEAM in Stockholm this year.
I really enjoyed it :) https://underjord.io/code-beam-sto-2022.html
Elixir Meetup #5 ▶ hosted by Curiosum ▶ Miguel Cobá & Michał Buszkiewicz
5th Elixir Meetup hosted by Curiosum We discussed 2 presentations of our Elixir experts:
- Miguel Cobá: Elixir, Kubernetes and minikube
- Michał Buszkiewicz: A Framework for Unified Authorization in Elixir
Check the video!
▶ https://curiosum.com/sl/e38klg5u
REGISTER FOR THE NEXT ELIXIR MEETUP: ▶ https://curiosum.com/meetups/elixir
Using IO.puts and IO.inspect in ExUnit tests
By default in the test env, Phoenix doesn’t show IO.puts/IO.inspect outputs in the console. Debugging without access to these two functions may be a pain in the neck. Fortunately, there is a simple solution, you can apply in just a few seconds. Check the TIL: https://curiosum.com/til/io-puts-and-inspect-in-exunit-tests
Elixir is taking over! 5 Elixir Meetups behind us - check how was it!
Five Elixir Meetups are behind us! Who were the speakers, how many people attended, what is the idea? https://curiosum.com/blog/elixir-is-taking-over-meetups-curiosum-behind
Read raw request body from Plug.Conn after parsers
If you ever tried to use Plug.Conn.read_body/2 and it returned nil, you now know that it can only be used once. If you have :json in your Plug.Parsers, you cannot read the raw body again, because it was already used by the parser. That’s a trick Plug does to save memory as request bodies can be of any size. However there’s a way to cache the raw body when you need it:
Read more: https://vinibrasil.com/plugrawbody
Showing how to use LiveView with Nerves
These are a few of my favorite things, as they say. I had no voice but it turned out quite artistic. Love to my editor for that. https://youtu.be/Fude1tM3kg0
ThinkingElixir 100: 10 Years of Elixir with José Valim
The 100th episode of Thinking Elixir is spent with José Valim celebrating 10 years of Elixir. We close out our 5-part series talking about the recent 1.13 release, the upcoming 1.14 release and looking into the future and v2.0. We learn that many features were created with Nx in mind but are still broadly helpful to Elixir developers. José gives a 1-minute explanation of how ex_unit works, explains what usually makes it into a point release, and how adding stepped ranges meant changes to many Enum functions and so much more! In addition to Elixir, we talk about his journey with Dashbit and we end up learning how the song “The Final Countdown” by Europe might actually be teaching functional programming and recursion?? A super packed episode!
Livebook for Elixir: Just What the Docs Ordered
Check out some top tips for using Livebook in Elixir and find out how to create interactive docs. https://blog.appsignal.com/2022/05/24/livebook-for-elixir-just-what-the-docs-ordered.html
