TwistingTwists
This is a thread to note down things/best practices encountered in LiveBeats App as I explore the source code.
https://github.com/fly-apps/live_beats/blob/master/lib/live_beats_web/controllers/user_auth.ex#L29
Found this usage of rescue/1
I’ve been meaning to handle Ecto errors myself. So this comes in handy for next time.
Trending in Guides/Tuts
I’ve spent some time understanding how to do hot code reloading with releases built using mix release, and here I’d like to detail the st...
New
Other Trending Topics
A new screencast on live LiveView updates with PubSub, the Oban Web dashboard, and smarter retries. Part 2 of 2. Screencast + full walkth...
New
Edit: 2026 May 15 - This post is archived.
Mob is alive!!
Main docs: mob v0.7.11 — Documentation
A bit of explanation for the slightly c...
New
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
Hobbes is a low-level distributed database for the Elixir programming language.
Hobbes provides a simple, safe, and scalable storage lay...
New
Hi everyone!
The first release candidate for the Expert language server project is now available!
We’ve published a press release detai...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ai
- #ecto-query
- #elixirconf-us
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #elixirconf-eu
- #api
- #forms
- #metaprogramming
- #hex











Showing Posts 1 to 10- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
cvkmohan
Nice exercise @TwistingTwists
TwistingTwists
Who is current user in liveview app ? (even during redirects) More than just :fetch_current_user plug
live_beats/lib/live_beats_web/controllers/redirect_controller.ex at master · fly-apps/live_beats · GitHub
This has
conn.assigns.current_user- without worrying thatcurrent_usermight not exist.above is possible because of plug
:fetch_current_userhere → live_beats/lib/live_beats_web/controllers/redirect_controller.ex at master · fly-apps/live_beats · GitHubTwistingTwists
OneLiner For loop
https://github.com/fly-apps/live_beats/blob/master/lib/live_beats_web/live/live_helpers.ex#L494
Never seen a for loop like this before.
Practical render_slots
live_beats/lib/live_beats_web/live/profile_live.ex at master · fly-apps/live_beats · GitHub
Message passing other component from present one - JS.push
live_beats/lib/live_beats_web/live/profile_live.ex at master · fly-apps/live_beats · GitHub
“switch_profile” is in
player_live.exlive_beats/lib/live_beats_web/live/player_live.ex at master · fly-apps/live_beats · GitHub
Pattern Matching - via two variables in function - elegant
matching if current user is same as profile user or any other case.
live_beats/lib/live_beats/accounts.ex at master · fly-apps/live_beats · GitHub
TwistingTwists
I think I should write @docs in a forked repo instead, no?
RudManusachi
First of all, thank you for this initiative!
I’d recommend to post a “permalink” to the line in the commit. That file was changed 7 hours ago. And looks like the link doesn’t point to the place you meant to.
dorgan
Protip: if you press Y while seeing a github file it replaces the url at the address bar with a permalink so you can copy that instead of scrolling and clicking copy permalink
TwistingTwists
Will take care.
https://github.com/TwistingTwists/live_beats/commit/36a775819ec2604cfe883eab6d5b198ffb3b7cd1
Added comments in this forked repo for consistency!
sergio
Excellent thread. Pinging @slouchpie so we can comb through this lots of good nuggets!
TwistingTwists
" Explain for loop : "
for a for {key, %{metas: metas}} <- presences, into: %{} dowhat does
into:do?as explained by @kartheek - from elixir-lang
must remember :
A comprehension is made of three parts: generators, filters, and collectables.kartheek
it collects into %{} in this case
The codefrom live_beats app is transforming presences - adding users and meta to every key in the presences. Final result will be
%{key1 => %{metas: <..>, user: <..> }, key2 => %{metas: <..>, user: <..> }}