I have started a new project and decided to document my travels on medium.com.
I have usually shyed away from publishing my Elixir work, but figure I would break that habit.
Please note: This is not a finished project, but I intend to use medium.com as more of a journal of my progress and my learnings about one of my favourite video games as a kid.
I love both Elixir and Monkey Island. I started working on something similar for another game, but then came life⦠So Iām keeping my fingers crossed and Iām sure youāll enjoy the ride!
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.
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.
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
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
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.
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:
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.
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.
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.