Elixir Blog Posts

I was playing around with rewriting Diablo 1 in Elixir. Had some good progress on that. The dopamine hits that I had while doing it were pretty intense. Unfortunately I kind of got sidelined by trying to build bindings to SDL2. I would come back to this in spare time, but maybe it’s better to build bindings to something more powerful like the Godot engine.

2 Likes

We followed up our post on logging with a review of the best Elixir log management tools to give you insight into your production system logs.

I see that @staknine published a little about logging, so I finally managed to catch up with my “todo” list of blogposts and I have published detailed insights into current Logger implementation with all the stuff that come up after Elixir 1.11 and merging with Erlang’s logger.

6 Likes

Uploading files with Phoenix and Javascript? Stephanie Vizzi has created a step-by-step reference to guide you through the process: Phoenix File Uploading via JavaScript

3 Likes

I wrote instructions to get up and running with Stripe Checkout in a Phoenix LiveView app, hope it helps someone!!

https://www.stibbard.io/learning/elixir-phoenix-stripe-checkout

6 Likes

First blogpost about using systemd with Elixir applications

4 Likes

I wrote a blog post on how I used NextJS on Vercel to set up landing pages and blog for a Phoenix LiveView app hosted on Fly. Superfast and Practical Webapps using NextJS, Vercel, LiveView and Fly.io - aswinmohanme

Feedbacks and Suggestions are welcome :smiley:

5 Likes

Is there a particular reason you didnt just have your CI build the static app but still serve it with liveview? Nothing wrong with vercel but it feels a bit overkill just to «not pollute the main repo», when you can just have the static part in a separate repo anyways, or separate folder in monorepo :slight_smile:

That is also possible and I would have chosen it if I wasn’t working with NextJS. Vercel takes care of a lot of things from deploying close to people, getting a preview URL on every commit, image optimization, cache busting and DDOS mitigation. It handles everything related to the static site which otherwise I would have to maintain by myself.

In the future, once we hit a large amount of volume we might move to the setup you suggested as it is more economical at scale to serve everything from our own infra.

Yeah I wouldnt have asked if it wasnt for you already being on distributed infra (fly) with phoenix :slight_smile:

1 Like

I’ve been wanting to learn more about Elixir macros, so I wrote a blog post where I looked at the source code for if/2 and tried to figure out how it works:

2 Likes

If you use Next.js as the reverse proxy to phoenix, does it mean that the static assets of the phoenix server would have to go through the reverse proxy?

If you make the vercel and flyio hosts use completely separate domain name, ie: mydomain.com for vercel, and app.mydomain.com and use full url for all the cross links, then the reverse proxy should not be necessary and everything should be a little faster, right?

Yes, static assets also get proxied through Vercel. But the speed difference is negligible.

That is the recommended way for splitting Static and Dynamic apps, but IndiePaper is a platform. Authors should be able to share their books URL as indiepaper.me/books/awesome-book-id rather than app.indiepaper.me/book/awesome-book. If I was building a simple SAAS, where the app is private and with no shareable links I would have gone with that.

1 Like

Nicely written post :smile:

Re: the purpose of optimize_boolean, to add the optimize_boolean: true flag to the AST’s meta here

[Disclaimer: I have practically 0 experience in metaprogramming and erlang, so read this with the phrase “it seems to me” in mind]

My curiosity then led me to read the erlang source code for expand_case where this flag is used. There it checks if the expression you’re branching on returns_boolean and if so optimizes the case depending on the shape of the true/false branches.

If the false branch matches the AST [{'when', _, [Var, {{'.', _, ['Elixir.Kernel', 'in']}, _, [Var, [false, nil]]}]}] then it rewrites the case clause to [false] and optimizes away the Kernel.in call, which is exactly what is sent to optimize_boolean from the code you analysed in the post!

In summary, if the if statement will return a boolean, then there’s no need to check for nil inclusion in the list with in/2.

1 Like

Glad you liked it!

And thanks for sharing what you found re: optimize_boolean. I noticed it was setting the flag to true, but just wasn’t sure what the purpose of that flag was.

Makes sense that you’d want to get rid of Kernel.in if there’s no chance of nil being returned.

1 Like

Newbie to Elixir but wrote a blog post about integrating with a pub/sub event broker: Event Driven Elixir – TKTheTechie

1 Like

Last year I wrote five part articles series - “Writing Git in Elixir” on medium.com.
Here are the links in case anyone is interested to read -

  1. Building Git in Elixir — Part 1 (Initialize Repo & Store blobs) - Building Git in Elixir — Part 1 (Initialize Repo & Store blobs) | by Meraj Molla | ITNEXT

  2. Building Git in Elixir — Part 2 (Store Trees & Initial Commit) -
    https://itnext.io/building-git-in-elixir-part-2-store-trees-initial-commit-9013ed02b75a

  3. Building Git in Elixir — Part 3 (Make History & Store Executables)
    https://itnext.io/building-git-in-elixir-part-3-make-history-store-executables-e7dbb39e8e47?sk=3a4f275892e3c4802f20b4b19abcb006

  4. Building Git in Elixir — Part 4 (Store Nested Trees as Merkle Tree) -
    https://itnext.io/building-git-in-elixir-part-4-store-nested-trees-as-merkle-tree-1a236882215a?sk=72d94cf323ba17d08c9580f6345d2e6f

  5. Building Git in Elixir — Part 5 (Build Index) -
    https://itnext.io/building-git-in-elixir-part-5-build-index-e10098836a83?sk=87cd1b215626b01909295704c3ce6bae

Thanks!

9 Likes

Thanks for sharing. Now we just need to build a GitHub/Gitlab OSS equivalent in Elixir :sunglasses:

Thanks! It’s possible to extend it though with more essential git features!

3 Likes