Elixir ▷ Max

@mxgrn.com

https://x.com/elixirtap Have *you* fallen for #ElixirLang yet? TILs and reflections from my 10 years with Elixir. Cranking out Elixir for jumpapp.com on weekdays. Cooking on my days off.

A small TIL for Git lovers: `git merge-base HEAD main` gives you the nearest common commit between the current branch and main. That's the commit where those two parted ways.

People have always been wary of computer viruses, and for good reason. Now, we have much smarter non-deterministic (!) systems running our VPSs and laptops, online, with increasing access to other services. What can go wrong?

So sad that Telegram has a bad reputation in the West. It's *by far* the best UI/UX messenger out there. WhatsApp doesn't even come close (although I love the fact that it runs on the BEAM).

Want a supervised task to finish (not get killed) during rolling #ElixirLang deployments? Simply trap the exit: Task.Supervisor.start_child( MyApp.TaskSupervisor, fn -> Process.flag(:trap_exit, true) do_work() end ) The task will have 5 seconds to finish.

Just downloaded ChatGPT Atlas, and I must say this direct browser-ChatGPT integration can be very useful. It just walked me through creating a free-form Google Analytics report, which I had no knowledge of. Previously, I'd need to send ChatGPT screenshots of where I was, and it was tedious.

Are you learning a foreign language by any chance? And what are the odds you use Telegram too? 🤔 I’ve been building a Telegram bot that finally makes vocabulary learning with spaced repetition fun for me, thanks to LLMs. Maybe it will for you, too. Give it a try: t.me/lexicornbot?...

TIL: If you append /rss to the link of any bsky profile, you'll get, well, an RSS feed. Handy if you really don't want to miss posts from a specific someone.

Want to disable all unmocked HTTP calls from Req at once during #ElixirLang tests? Simply add this to test/test_helper.exs: Req.default_options( adapter: fn req -> raise "Unmocked call to #{req.url}" end ) (replace `raise` with a log warning if that's more useful)

It's easy to keep nudging the AI until it 'fixes' the tests, and it feels like achieving something, while the value of such tests may be plainly negative. Seeing too many false positives like that lately.

When to name your #ElixirLang function with a bang? Only if the function is *expected* to throw errors during normal execution. Do not simply 'inherit' bangs from what’s inside that function (`Repo.update!`) if those exceptions would signal a bug (that is, should never happen).