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.

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

21 hours 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

15 days 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

28 days 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

1 month 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

1 month ago

0

Chain failable operations cleanly with `with`

Nested case statements for operations that can fail look neat at first — until you need three of them. with lets you sequence failable operations and ...
almirsarajcic

almirsarajcic

1 month ago

0

Split async and sync tests in one file

Marking a test module async: false serializes every test inside it. If only two tests genuinely need it — because they touch a globally-named Task.Sup...
almirsarajcic

almirsarajcic

1 month ago

0

optimum_credo v0.4.0

We've moved to almost fully autonomous AI-driven development and rely less on human code review. We're pushing more into Credo — mechanical rules that...
almirsarajcic

almirsarajcic

1 month ago

0

Override config in async tests

Application.put_env/3 in tests mutates global state. Two concurrent tests overwriting the same key will race — the restore in on_exit runs after the o...
almirsarajcic

almirsarajcic

2 months ago

0

`Phoenix.Token` beyond `mix phx.gen.auth`

If you've used mix phx.gen.auth, you've already seen Phoenix.Token at work — it's what powers the email verification and password reset links in the g...
almirsarajcic

almirsarajcic

2 months ago

0

Chain failable operations cleanly with `with`

Nested case statements for operations that can fail look neat at first — until you need three of them. with lets you sequence failable operations and ...
almirsarajcic

almirsarajcic

2 months ago

0

`Repo.stream/2` processes database results without loading all rows

Exporting a million database rows? Repo.all/2 loads everything into memory first. Repo.stream/2 uses database cursors to fetch rows in batches, keepin...
almirsarajcic

almirsarajcic

2 months ago

0

optimum_credo v0.3.0

optimum_credo version 0.3.0 was released....
almirsarajcic

almirsarajcic

2 months ago

0

Pause an Oban job with `{:snooze, seconds}`

Sometimes a job isn't ready to run yet — a third-party API is rate-limiting you, a resource hasn't been created, or you just need to wait a few minute...
almirsarajcic

almirsarajcic

3 months ago

0

Use `Integer.parse/1` for params, not `String.to_integer/1`

Phoenix does zero automatic type coercion. Every value in params arrives as a string — or not at all. Reaching for String.to_integer/1 on user-supplie...
almirsarajcic

almirsarajcic

3 months ago

0