⚗️ Elixir Tip #79 - Built-in JSON ⚗️
Did you know that Elixir has shipped with a JSON module since v1.18? You may not need that 3rd party library anymore. You can even derive the encoder for your structs!

⚗️ Elixir Tip #79 - Built-in JSON ⚗️
Did you know that Elixir has shipped with a JSON module since v1.18? You may not need that 3rd party library anymore. You can even derive the encoder for your structs!
⚗️ Elixir Tip #78 - Printf style formatting ⚗️
Need to line up some numbers in the terminal? The Erlang :io and :io_lib modules give you printf style formatting with padding, precision and even number bases!
⚗️ Elixir Tip #77 - Building output with IO lists ⚗️
Stop concatenating strings in a loop! IO lists let you build up output from nested lists of binaries and bytes. Files, sockets and ports all accept them directly!
⚗️ Elixir Tip #76 - Profiling with tprof ⚗️
OTP 27 introduced tprof, a single profiler for call counts, execution time and even memory usage. Reach for it when you need to know which function is doing all the allocating!
⚗️ Elixir Tip #75 - Powerful comprehensions ⚗️
for comprehensions can do a lot more than Enum.map. You can have multiple generators, filter with pattern matches and use :into, :uniq and :reduce to shape the output!
⚗️ Elixir Tip #74 - Querying ETS with match specs ⚗️
Match specs look a little scary at first, but they let ETS filter your data for you instead of copying the whole table over to your process. Great for time series data!
⚗️ Elixir Tip #73 - Sorting dates ⚗️
Enum.sort/1 compares structs field by field, which gives you the wrong answer for dates! Pass in the Date module and let it do the comparing. It works for :desc as well!
⚗️ Elixir Tip #72 - Encrypting data with AES-GCM ⚗️
Need to encrypt some data? The Erlang :crypto module has AES-GCM built in, and decryption fails if anything was tampered with. Just make sure to never reuse an IV with the same key!
⚗️ Elixir Tip #71 - Tracing calls with :dbg ⚗️
Not to be confused with Kernel.dbg/2! The Erlang :dbg module traces function calls on a running system, arguments and return values included. Just be careful on busy nodes!
⚗️ Elixir Tip #70 - Task deadlines ⚗️
Task.await/2 takes down the caller if a task runs too long. Pair Task.yield/2 with Task.shutdown/2 to grab the result if it's ready and clean up the task if it isn't!
⚗️ Elixir Tip #69 - Disk based storage with dets ⚗️
Like ETS but want your data to survive a restart? The Erlang :dets module stores your terms on disk using a very familiar API. Just keep in mind the 2GB limit per file!
⚗️ Elixir Tip #68 - Monte Carlo with :rand ⚗️
The Erlang :rand module can do more than generate integers. Seed it for reproducible runs and sample from a normal distribution for some quick Monte Carlo simulations!
⚗️ Elixir Tip #67 - Comparing versions ⚗️
Did you know that comparing version strings will tell you that 1.10.0 is older than 1.9.0? The Version module understands semantic versions and even requirements like ~> 1.9!
⚗️ Elixir Tip #67 - Comparing versions ⚗️
Did you know that comparing version strings will tell you that 1.10.0 is older than 1.9.0? The Version module understands semantic versions and even requirements like ~> 1.9!
⚗️ Elixir Tip #66 - Process groups with pg ⚗️
Did you know that OTP ships with process groups? Using :pg, processes can join a named group and anyone in the cluster can find them. A great building block for pub/sub!
⚗️ Elixir Tip #65 - Enum reduce_while ⚗️
Need to bail out of a reduce early? Enum.reduce_while/3 lets you decide on every iteration if you want to :cont or :halt, so you don't have to walk the whole list!
⚗️ Elixir Tip #64 - Formatting dates and times ⚗️
Before you reach for a 3rd party library to format your timestamps, check out Calendar.strftime/3. It supports all the usual format codes and it's built right into Elixir!
⚗️ Elixir Tip #63 - Order books with gb_trees ⚗️
Need key/value storage that keeps everything sorted? The Erlang :gb_trees module is a great fit for something like an order book where you always want the best price!
⚗️ Elixir Tip #62 - UDP with gen_udp ⚗️
Need to fire off some telemetry without all of the ceremony of TCP? The Erlang :gen_udp module gets you sending and receiving UDP packets in just a couple of lines!
⚗️ Elixir Tip #61 - Process lookups with Registry ⚗️
Need to find a process using something other than its PID? The Registry module lets you name processes with any term you like. Just hand GenServer or Agent a :via tuple!