Latest Drops

Welcome to ElixirDrops!

ElixirDrops is a collection of short, practical Elixir, Phoenix and OTP tips. Sign in with GitHub to share your own Drops and join the discussion.

Screenshot preview of Serializing shared tests with ExUnit groups

Serializing shared tests with ExUnit groups

If several test modules change the same application setting, you can put them in one ExUnit group and let unrelated tests stay async. In Elixir 1.18+,...

almirsarajcic

yesterday

Comments: 0
Screenshot preview of Keeping monthly billing dates from drifting

Keeping monthly billing dates from drifting

If a subscription starts on January 31, 2026, a one-month shift gives you February 28. Shift again from there and the next bill lands on March 28. Kee...

almirsarajcic

8 days ago

Comments: 0
Screenshot preview of Starting a Phoenix app with Phoenix Express

Starting a Phoenix app with Phoenix Express

To start a Phoenix application on macOS or Ubuntu, you can use Phoenix Express:...

almirsarajcic

12 days ago

Comments: 0
Screenshot preview of Sharing ElixirDrops sponsorship revenue

Sharing ElixirDrops sponsorship revenue

I'm trying revenue sharing on ElixirDrops through the end of December. To qualify, you need at least five published Drops in total on ElixirDrops. Dro...

almirsarajcic

14 days ago

Comments: 0
Screenshot preview of Computing map defaults only when needed

Computing map defaults only when needed

If your app takes a region from its options and falls back to an environment variable, Map.get/3 can raise even when the region is already set:...

almirsarajcic

14 days ago

Comments: 0
Screenshot preview of Passing match suffix to ecto's foreign_key_constraint/3

Passing match suffix to ecto's foreign_key_constraint/3

TIL that ecto's foreign_key_constraint/3 can match constraint names by suffix. You don't have to list every constraint by its full name. You write the...

jrowah

15 days ago

Comments: 0
Screenshot preview of Keeping the socket out of async tasks

Keeping the socket out of async tasks

If your assign_async/3 callback reads socket.assigns.user_id, it captures the whole socket, even though the query only needs an ID:...

almirsarajcic

18 days ago

Comments: 0
Screenshot preview of Introducing KogenCredo 0.1.0

Introducing KogenCredo 0.1.0

Generated code can repeat mistakes in error handling and tests, so KogenCredo 0.1.0 adds 35 configurable Credo checks for patterns worth reviewing. E...

almirsarajcic

20 days ago

Comments: 2
Screenshot preview of Releasing OptimumCredo 0.5.0

Releasing OptimumCredo 0.5.0

OptimumCredo 0.5.0 adds a 74-check collection and moves three previously published checks to KogenCredo. If you use those checks, add KogenCredo as a...

almirsarajcic

20 days ago

Comments: 0
Screenshot preview of Namespacing module attributes in libraries

Namespacing module attributes in libraries

I was refactoring an Ash app and wanted to put boundaries between its domains, so I tried adding use Boundary to the existing Ash domain modules. That...

almirsarajcic

22 days ago

Comments: 0
Screenshot preview of Declaring opaque return types on constructors

Declaring opaque return types on constructors

Our Phoenix browser tests use PhoenixTest.Playwright to drive a real browser. Our additional-session helper asks the library to create a session, then...

almirsarajcic

24 days ago

Comments: 0
Screenshot preview of String.downcase/1 can turn garbage into valid input: use :ascii

String.downcase/1 can turn garbage into valid input: use :ascii

String.downcase/1 and String.upcase/1 follow Unicode case mapping. That's usually what you want for human text, but not for identifiers:...

igorgbr

1 month ago

Comments: 1
Screenshot preview of Choosing Elixir tools with elixir.menu

Choosing Elixir tools with elixir.menu

elixir.menu is a guide to choosing tools for Elixir applications, from command-line utilities to Phoenix web apps. It covers libraries and built-in OT...

almirsarajcic

1 month ago

Comments: 0
Screenshot preview of Admit when you’re wrong

Admit when you’re wrong

People in the Elixir community shouldn't be butthurt about DHH's Campfire benchmarks. We should use them as an opportunity to look at the state of the...

almirsarajcic

1 month ago

Comments: 1
Screenshot preview of Trapping exits so terminate/2 actually runs

Trapping exits so terminate/2 actually runs

A GenServer that flushes buffered work in terminate/2 loses it when its supervisor shuts it down, unless the process traps exits:...

almirsarajcic

1 month ago

Comments: 0