Welcome to ElixirDrops!

Hello there and welcome to the ultimate hub for the Elixir community! Whether you're a seasoned developer or just starting your journey, ElixirDrops is the perfect place to discover, share, and discuss the best tips and tricks for mastering Elixir. Sign in to explore, learn and become a contributor on this platform.

Download/Read Hex Library Doc Offline

You can use mix hex.docs fetch ash to download documentation and read them offline with mix hex.docs offline ash. Whats more amazing is that in your ...
mnkhod

mnkhod

5 hours ago

0

Give background processes useful labels

PIDs are not much help when several copies of the same worker are running. Process.set_label/1 adds a term that identifies what each process is doing....
almirsarajcic

almirsarajcic

23 hours ago

0

Build an Ecto select a field at a time

An Ecto query has one select, which can make optional query helpers awkward. select_merge/3 lets each helper add fields to an existing map select. ``...
almirsarajcic

almirsarajcic

2 days ago

0

Find wide compile dependencies with `mix xref graph`

When a small change recompiles a large part of an application, mix xref graph can show which file has the widest compile-time reach....
almirsarajcic

almirsarajcic

2 days ago

0

Test CLI input and output with `CaptureIO`

Test terminal behavior through the real IO calls instead of replacing IO.gets/1 or IO.write/2 with mocks. ExUnit.CaptureIO.capture_io/2 supplies stdin...
almirsarajcic

almirsarajcic

18 days ago

0

`GenServer.call/3` timeout does not cancel work

Treat the third argument to GenServer.call/3 as a caller deadline, not a cancellation mechanism. When the deadline expires, the call exits the caller ...
almirsarajcic

almirsarajcic

20 days ago

0

Let `Task.async_stream/3` emit fast work first

Task.async_stream/3 quietly holds fast results behind the earliest slow input because ordered defaults to true. When independent IO work does not need...
almirsarajcic

almirsarajcic

20 days ago

0

How LiveView decides what to re-render

Your LiveView does not re-render its template when an assign changes. It re-runs only the fragments that read an assign that actually changed, and com...
almirsarajcic

almirsarajcic

1 month ago

0

Build a LiveView wizard that remembers every step

Multi-step forms usually break in one of two ways: they lose everything when the user clicks "Back", or they defer all validation to the final submit....
almirsarajcic

almirsarajcic

1 month ago

0

Schemaless changesets validate forms without the database

Need to validate form data, preview changes, or validate multi-step workflows without hitting the database? Use schemaless changesets with Ecto.Change...
almirsarajcic

almirsarajcic

1 month ago

0

Stop mounting your LiveView twice

Every LiveView mounts twice on first page load — once for the static HTTP "dead render," then again when the WebSocket connects. If mount/3 loads data...
almirsarajcic

almirsarajcic

1 month ago

0

`:persistent_term` outperforms ETS for static data

ETS is the default for shared lookups, but for read-only data that never changes at runtime it does work you don't need: every read copies the term ou...
almirsarajcic

almirsarajcic

2 months ago

0

Speed up CI with parallel ExUnit partitions

Running your full test suite sequentially in CI is wasted time. ExUnit has built-in support for partitioning — split your suite into N slices and run ...
almirsarajcic

almirsarajcic

2 months ago

0

`assign_new/3` prevents expensive recomputations in LiveView

Calling assign/2 recalculates values every time the socket updates, even if the data hasn't changed. Use assign_new/3 to compute expensive operations ...
almirsarajcic

almirsarajcic

3 months ago

0

`Req.Test` stubs keep HTTP out of your tests

Req ships with a built-in test stub mechanism. No Bypass, no Mox, no additional dependencies — just three small changes and your HTTP calls never hit ...
almirsarajcic

almirsarajcic

3 months ago

0