Philippe Creux

95 Followers
87 Following
137 Posts
Software developer.
Bloghttps://pcreux.com
Pronounshe/him
@Ryanbigg Do you use IDs that are prefixed with the type of thing? (ex: `cc_123` for credit cards?)

TIL: BigQuery only allows 4000 table partitions.
TIL: Zipline has been around for 4001 days!

"Too many partitions produced by query, allowed 4000, query produces at least 4001 partitions."

Complex authorization rules defined with boolean expressions are hard to debug and don't allow us to tell users _why_ they can't perform a task.

That's what pundit and activepolicy rely on, though. Maybe cancan did better?

I put together a little something to define rules and compose them so that we can introspect them. WDYT?

https://gist.github.com/pcreux/16c7689cb2c5a6d28def22609bc26089

TIL: 25 days in milliseconds overflows a 32-bit integer.
So setTimeout(25 * daysInMs) silently becomes setTimeout(0).
No wonder we got hammered by keepalive requests. ๐Ÿ˜ฌ

TIL: `Array.inquiry`

```
ยป list = ["foo", "bar", "baz"].inquiry
=> ["foo", "bar", "baz"]
ยป list.foo?
=> true
ยป list.cat?
=> false
```

@remi Not true! I ask ChatGPT to write JS. ๐Ÿ˜ฌ
"Content missing" no more!
Here is a handler to embed the response when turboframe fails to load.
https://gist.github.com/pcreux/3cecd8d51c0d3ccc535f2b01d979a13e
@ybocharov Thank you!
dry-struct checks types so it enforces the contract between the SQL query and the Ruby object. It will raise an error if there's a type mismatch of if a value is missing.

New blog post!

Rails Dashboards that scale with SQL and `dry-struct`

Crunch data with SQL, return JSON, wrap it in type-safe DryStructs, and swap in Faker or plug into a data warehouse.

https://pcreux.com/2025/07/09/rails-dashboards-with-sql-and-dry-struct

Rails Dashboards with SQL and dry-struct - Philippe Creux

Rails Dashboards that scale: crunch data with SQL, return JSON, wrap it in type-safe DryStructs, and swap in Faker or plug into a data warehouse.

@arthru

```
irb(main):001> ๐Ÿฅš = 'oeuf'
=> "oeuf"
irb(main):002> ๐Ÿ” = 'poule'
=> "poule"
irb(main):003> [๐Ÿฅš, ๐Ÿ”].sort
=> ["oeuf", "poule"]
```