Readit News logoReadit News
napsterbr commented on Campfire: Web-Based Chat Application   github.com/basecamp/once-... · Posted by u/thunderbong
nomilk · 10 hours ago
Reading through some controllers and models, haven't encountered a single code comment yet, just chiselled-out ruby.

Arbitrary examples:

https://github.com/basecamp/once-campfire/blob/main/app/cont...

https://github.com/basecamp/once-campfire/blob/main/app/cont...

https://github.com/basecamp/once-campfire/blob/main/app/mode...

napsterbr · 9 hours ago
Reminds me of Ash (Elixir framework).

Seems great on paper, but quickly turns into a nightmare. Magic is great to get you up to speed, but as soon as you find yourself having to bend the magic, good luck.

napsterbr commented on I let LLMs write an Elixir NIF in C; it mostly worked   overbring.com/blog/2025-0... · Posted by u/overbring_labs
cess11 · 23 days ago
Is there a reason why you're using 'when is_struct/2' instead of pattern matching here?

https://github.com/cpursley/livefilter/blob/main/lib/live_fi...

napsterbr · 23 days ago
This is clearly low quality, non-idiomatic AI-generated Elixir code. So the likely answer is that "you" did not use this at all; AI did.

I review this kind of AI-generated Elixir code on a daily basis. And it makes me want to go back to ~2022, when code in pull requests actually made sense.

Apologies for the rant, this is just a burnt out developer tired of reviewing this kind of code.

PS: companies should definitely highlight "No low-quality AI code" in job listings as a valid perk.

napsterbr commented on Shardines: SQLite3 Database-per-Tenant with ActiveRecord   blog.julik.nl/2025/04/a-c... · Posted by u/julik
napsterbr · 4 months ago
Coincidentally I'm working on FeebDB[0], which is similar but for Elixir instead. It can be seen as a replacement to Ecto (which won't work well when you have thousands of databases).

Mostly as a fun experiment, but also from the realization that every place I worked at in the past (small/medium-sized B2B startups) would greatly benefit from such architecture.

Yes, there are massive trade-offs to this approach, and the concerns raised in the comment section are valid. This doesn't mean the database-per-tenant is never worth it. There's a sweet spot for it, and if it fits your business/application, I personally would consider it a technical advantage over competitors.

My goal with FeebDB is to eliminate or reduce the common pain points of database-per-tenant, including:

- ensure there is a single writer per database.

- improved connection management across all tenants (e.g. only keep open at most 1000 DB connections, similar to an LRU cache).

- on-demand migration (all shards are migrated on application startup, but if a shard that hasn't migrated yet receives a request, it will first perform the migration and then serve the request),

- on-demand backups and replication (e.g. the library knows which shards were updated in the last X minutes, so it can trigger Litestream or similar on demand).

- support for enumeration of databases (performing map/reduce/filter operations across multiple DBs)

- support for clustered deployment with "pinned" tenants (for now I'm assuming the IOPS of a single beefy server should be enough for all use cases, but once that's no longer sufficient you can have "shards of shards")

[0] - https://github.com/renatomassaro/FeebDB/

napsterbr commented on OpenAI asks White House for relief from state AI rules   finance.yahoo.com/news/op... · Posted by u/jonbaer
tasuki · 6 months ago
I heard the theory that Elon Musk has a significant control over the current US government. They're not best pals with Sam Altman. This seems like it might be a good way to see how much power Elon actually has over the government?
napsterbr · 6 months ago
I think we are beyond the "theory" phase by now. Just yesterday I saw the president of a country advertising the products of a private company (Trump making an obvious marketing ploy for Tesla).

How can this ever be acceptable?

napsterbr commented on Self hosted FLOSS fitness/workout tracker   github.com/wger-project/w... · Posted by u/freemh
napsterbr · 7 months ago
Another interesting self-hosted tracker is https://ryot.io/.

Demo: https://demo.ryot.io/_s/acl_vUMPnPirkHlT

Code: https://github.com/IgnisDa/ryot

(PS: they opted to go in a direction where it also includes some media-related features -- like tracking movies or books you've seen/read -- but this can be disabled).

napsterbr commented on Ask HN: Why buy domains and 301 redirect them to me?    · Posted by u/HughParry
napsterbr · 7 months ago
Whatever their play, detect and drop the redirects. Good job on noticing it early on!
napsterbr commented on How do interruptions impact different software engineering activities   rdel.substack.com/p/rdel-... · Posted by u/kiyanwang
jjallen · 8 months ago
I find taking mini breaks, whether visiting the restroom or being interrupted by my kids to be quite beneficial actually.

It gives my mind a few seconds or a minute or two to do background processing and potentially come up with a better way of doing something.

Or to realize that I’m not working on the most important thing in the first place.

napsterbr · 8 months ago
Sure, and I agree with you, but what you described is just a break, not an interruption.

These breaks were taken at a "natural" time, when you felt one was needed. By definition, an interruption is a "break" when you don't want one.

napsterbr commented on Database mocks are not worth it   shayon.dev/post/2024/365/... · Posted by u/shayonj
ryan-duve · 8 months ago
Do you have a link you can share that demonstrates the details of this approach?
napsterbr · 8 months ago
The entire project is open source, so sure! :D

I actually have two projects that use this approach, FeebDB (which is the library I wrote to manage a "one SQLite database per client" approach) and HackerExperience (a game under development that uses FeebDB).

The overall idea is simple:

1. Before tests start running, create a prop of each database.

2. The prop contains the "starting database" for each test. It may contain seed data (optional).

3. For each test, copy the prop and assign it a unique shard identifier (say, cp /props/user.db /test_data/user/874125.db).

4. The test knows the `shard_id` and can do whatever it wants with it; no one else will bother it.

5. Once ExUnit is finished, delete all shards.

Both projects follow a similar approach (I wrote it first in FeebDB and copied into HackerExperience, which has some sections commented out -- I need to clean up this part of the codebase).

For both projects, you will find steps 1/5 in `test/support/db.ex`, step 2 in `test/support/db/prop.ex` and steps 3/4 in `test/support/case/db.ex`.

- FeebDB: https://github.com/renatomassaro/FeebDB/

- HackerExperience: https://github.com/HackerExperience/HackerExperience/

Email is in profile in case you have follow up questions/comments :)

napsterbr commented on Database mocks are not worth it   shayon.dev/post/2024/365/... · Posted by u/shayonj
andy_ppp · 8 months ago
As per usual Elixir does this correctly and even has a setup that allows all tests to run against the database in a pristine way in parallel: https://hexdocs.pm/ecto_sql/Ecto.Adapters.SQL.Sandbox.html
napsterbr · 8 months ago
A hobby project of mine (in Elixir) uses SQLite as primary database. Each test runs in its own fully isolated SQLite database. No mocking (or transaction rolling back) needed. Most of these tests take less than 1ms to run (and when they take longer, it's because of something else).

This kind of setup makes the usual Ecto Sandbox approach feel slow, but I do agree that the way Elixir approaches this is great!

u/napsterbr

KarmaCake day2549November 25, 2013
About
Howdy!

You can reach out to me at r@ena.to

https://github.com/renatomassaro

View Original