How Absinthe Uses Compilation Callbacks for Schema Validation in Elixir
Let’s look closely at how Absinthe uses some metaprograming tricks and module attributes to provide compile-time schema validation for us.
Create a crypto bot in Elixir ebook updated (early alpha 2)
https://leanpub.com/create-a-cryptocurrency-trading-bot-in-elixir/
4 new chapters, All code starting from chapter 2 got refreshed, logs improved and many descriptions rephrased.
Surpassed 100 pages 🍾 Enjoy ❤️
Getting started with PETAL
As a follow-up to my post about the PETAL stack on the Changelog.com blog I put together this getting-started-guide for anyone wanting to try it out. Hope it helps: https://underjord.io/getting-started-with-petal.html
Open-source Deep Dive: Hound
Started a new blog series - Open-source Deep Dive - where I dissect an open-source project and try to understand the project and the underlying technologies that power it!
The project to kick start this series is Hound - an Elixir library for browser automation and integration testing!
For this project, I explored how browser automation works and looked at how Hound takes fundamental principles of Elixir to build a robust library for writing integration tests with browser automation. I tried to focus on keeping the explanations clear and simple for even beginners to understand!
The post can be found here: https://woojiahao.github.io/blog/posts/2021-01-10-Open-source Deep Dive: Hound
IntelliJ Elixir v11.9.1
Changelog
v11.9.1
Bug Fixes
-
Fix syntax highlighting stopping due to decompiling of
Kernel
failing caused by bugs introduced in #1834. Syntax highlighting could fail part way through a file whenKernel
needed to be decompiled to resolve parts of the syntax. This would lead to the file to be colored above a certain point, but then the default gray after that point.-
Connect compiled stubs to decompiled source by name/arity.
Previously, when the decompiler didn’t use the
Docs
, it was guaranteed that thePsiCompiled
stubs would correlate, in-order, with the decompiled source call definitions, and so mirrors could be set by matching up the list of them in order. Since theDocs
doesn’t have to correspond to and doesn’t correspond to the binary precisely for some BEAMs, most importantly,Elixir.Kernel.beam
, the PsiCompiled stub and decompiled source is now matched by name and arity. This means some mirrors are missed, but no errors are produced. -
Allow decompile source to map to entire arity range
Since the decompile source from
Docs
can have default arguments the call definition clauses can have an arity range and not just a fixed arity, so all arities in the range need to be mappable toPsiCompiled
functions. -
Use correct macro for signature from
Docs
. Ensures that defmacro is used for macros instead of hard-codingdef
as in #1834. -
Use
~S”””
for docs fromDocs
chunk. The docs from theDocs
chunk may contain interpolation in the code samples or#{
in regex examples, but these should not be treated as an interpolation start as theDocs
format does not support interpolation. Anything that looks like interpolation in the docs text was actually escaped in the original docs, so also escape it here by usingS”””
, which turns off interpolation. -
Log an error if
Code
function can’t be matched to decompiled source. Unlike the oldInvalidMirrorException
, this won’t be an exception and the binary <-> decompile will still work for the other functions/macros in the file, so it will be a more graceful degradation.
-
Connect compiled stubs to decompiled source by name/arity.
Previously, when the decompiler didn’t use the
-
Fix missed references to
DepsWatcher
as project componentDepsWatcher
was converted to a Project Listener in #1844 to support installing the plugin from the Marketplace without reloading, but some references toDepsWatcher
were still trying to get its instance for project usingproject.getComponent()
, which would now returnnull
. -
Target Java 1.8 for JPS compatibility. JPS (JetBrains Project System) is the API used to allow External Builders, like
mix
to build projects. -
Fix matching
unquote(ATOM)
call definitions to compiled function by using the argument tounquote
when calculating the name of the call definition clause if possible. Needed to match anonymous function names that areunquote
d because they contain/
to separate the outer function name from the anonymous function naming convention. -
Don’t use
Docs
signature forMacroNameArity
that is an operator orunquote
d The signatures for operators andunquote
d don’t produce valid code that can be parsed. -
Don’t use signatures for
__struct__
functions. The signatures for the__struct__
functions are like%Module{}
, but that’s not parseable, so bypass the signatures with a specializedSignatureOverride
decompiler that matches the actual code indefstruct
. -
Don’t indent empty lines from
Docs
for@moduledoc
and@doc
to match the formatter output. -
Fix capitalization of
Docs
@moduledoc
@moduleDoc
->@moduledoc
A hook for handling very large lists with Phoenix Live View
How to stream very large lists to improve page load & rendering time.
Elixir Wizards S5E7 Jason Axelson on the Elixir Language Server
Latest episode of Elixir Wizards is out today! Check it out here: https://smartlogic.io/podcast/elixir-wizards/s5e7-axelson/
RakNet game networking protocol in Elixir
We’ve open-sourced the most important component of the massive multiplayer server we use for the X-Plane flight simulator: an implementation of the RakNet protocol.
You can find it on GitHub, under the MIT license: https://github.com/X-Plane/elixir-raknet
A bit of background:
RakNet is a popular C++ library for doing game networking. It provides things like stateful connections, client clock synchronization (the bane of every network game programmers’ existence), and both reliable and unreliable UDP transmissions, so you can choose how much latency your packets can handle.
This is pretty niche stuff, but maybe it’ll be useful for someone else. Reverse-engineering this stuff from the RakNet source was, uh, a bit of a pain. 😄
EctoExtras - simple helper functions missing from the default Ecto implementation
EctoExtras is a set of simple helper functions for Ecto.Repo and Ecto.Query that I find missing from the default implementation. https://github.com/pawurb/ecto_extras
A guide to event handling in Elixir
6 ways of handling events in Elixir systems - a high level overview with trade-offs for each approach.
https://mkaszubowski.com/2021/01/09/elixir-event-handling.html
Elixir for Beginners: From Pipes to Pattern Matching and Beyond
We have collected all the tips, techniques, and patterns you need to do beginner-level Elixir programming in one article. Learn about higher-order functions, pattern matching, recursion, and more.
ElixirCasts 128: Using Twilio with Elixir
In this episode we’ll explore how to send text messages from an Elixir application. We’ll use Phoenix LiveView for our UI and Twilio to deliver our messages.
ThinkingElixir 030: Mutation Testing using Muzak with Devon Estes
In episode 30 of Thinking Elixir, we talk with Devon Estes who has created a new Elixir mutation testing library called Muzak. Devon joins us to explain what mutation testing is and how it can help development teams in organizations move faster and with greater confidence. We cover when a project can benefit from it, the challenges of offering a PRO library version, where Muzak is going in the future, and more!
Elixir in 2021: The Now, The Tomorrow, The Future
In a new article by Michal Buszkiewicz, find out whether & why there’ll ever be an Elixir 2.0, and learn about the philosophy behind the language’s development and its current state in 2021.
Early alpha "Create a cryptocurrency bot in Elixir" ebook released!
I’m proud to release an early alpha version of my book: https://leanpub.com/create-a-cryptocurrency-trading-bot-in-elixir Feel free to grill it as much as you want - any feedback appreciated, that’s the only way to get it better really ;)
Enjoy
Advent Of Code makes me a better programmer
Advent Of Code is a yearly coding challenge offered by Eric Wastl for the Christmas season. In this article I will share my AOC takeaways as an Elixir programmer.
https://www.christianblavier.com/advent-of-code-makes-me-a-better-programmer/
Extracting LiveView Logic into LiveComponents
How to extract LiveView logic into a LiveComponent, and how to exchange data both ways.
https://s2g.io/extracting-liveview-logic-into-livecomponents
How to connect Pow and Live View in your Phoenix project
Wrote a short blogpost about connecting Pow and Live View in a Phoenix project. Basically, it is a summary of existing knowledge from the Live View documentation and a long thread in the Elixir forum. I hope it is helpful for others, that enjoy Pow as much as I do.
https://dev.to/oliverandrich/how-to-connect-pow-and-live-view-in-your-phoenix-project-1ga1