Using raw Express + Prisma is messy once code becomes meaningful.
For example, implementing defaults code for models, so a new record can be initialized with JS code. It can be done with Prisma, but it is not pretty, and not discoverable by someone else reading the code.
It got me looking at other frameworks like AdonisJS and SailJS.
1
2
107
I think AdonisJS better captures the feeling of Rails. Perhaps I just like classes, but I much prefer Adonis’ router:
```
router.resource('posts', controllers.Posts)
router.get('/users', [controllers.Users, 'index'])
router.get('/comments', [controllers.Comments, 'index'])
Than SailJS:
module.exports.routes = {
'GET /signup': { view: 'conversion/signup' },
'POST /signup': { action: 'entrance/signup' },
'GET /login': { view: 'portal/login' },
'POST /login': { action: 'entrance/login' },
'/logout': { action: 'account/logout' },
'GET /me': { action: 'account/profile' }
```
And much prefer the AdonisJS models:
```
class User extends UsersSchema {
@beforeSave()
static async hashPassword(user: User) {
if (user.$dirty.password) {
user.password = await hash.make(user.password)
}
}
}
```
To SailJS:
```
module.exports = {
attributes: {
username: {
type: 'string',
required: true
},
password: {
type: 'string',
minLength: 6,
required: true
}
},
beforeCreate: function (valuesToSet, proceed) {
// Hash password
sails.helpers.passwords.hashPassword(valuesToSet.password).exec((err, hashedPassword)=>{
if (err) { return proceed(err); }
valuesToSet.password = hashedPassword;
return proceed();
});
}
};
```
1
1
58
"I flew too close to the sun right before this demo"
The sadness of breaking your code right before demoing it to the team.
2
36
It turns out we are not the only people to see crazy growth over the last few months. Github is seeing it too [1].
Not having usage caps (unlimited repos, unlimited commits, unlimited PRs) no longer works when those things are all being done by agents at scale, rather than by humans.
[1] github.blog/news-insights/co…
Heroku was always the obvious choice for quick hosting. Then there was this announcement [1]. Whatever that means ... don't use us for new projects?
So I thought I would try fly.io. A lot of similarities with the CLI, but just not quite as polished: cryptic errors and a couple of calls that didn't work the first time.
[1] heroku.com/blog/an-update-on…
1
1
110
Here is the email subject to use if you want me to read your random marketing email:
> you just gave your coworker the passwords
Mission accomplished. I was very confused reading the email since it was nothing to do with passwords.
34
Choosing the primary key type for a database is a choice with so many implications. The default choice: auto-incrementing sequence numbers is my least favorite approach. It makes it impossible to allocate sequence numbers in separate systems.
In my last big project I used a 64-bit integer divided up into 42-bits for a timestamp (~4ms resolution) and a 22-bit random number. This type of approach has some advantages:
* IDs can be allocated in a distributed way, independently of each other (e.g. in front-end code).
* IDs still provide creation ordering which can be useful for things like stable sorts and batch scripts. Though this order is not perfect because of the 4ms resolution. e.g. an UPDATE, DESTROY audit record could end up with IDs that make it appear like the DESTROY happened before the UPDATE.
* 64-bits are good for DB storage, and the creation-ordering makes efficient use of the index block cache.
* 64-bits are bad for Javascript. Treating record IDs as numbers in JS causes them to be truncated to 53 bits. So they need to be strings.
More in thread:
1
35
Recently I came across github.com/carderne/upid which is really intriguing. It has the same advantages I described above, plus some more:
* It also encodes the record type into the ID. This is great for debugging, and allows simpler polymorphic relationships.
* It has 64-bits of randomness, significantly reducing the risk of collisions. It is enough to be able to treat IDs as unguessable ... but not quite enough to satisfy cryptographic level unguessability.
* It has a pretty and compact textual form when users see IDs, e.g. `user_2accvpp5guht4dts56je5a`
* A small, but meaningful benefit: double clicking a UPID in an editor selects the whole thing. Unlike UUIDs which use dashes and are not selected on double click 😡
27
Normally I use Claude models through Google Vertex, but this morning I made the mistake of using claude.ai ... now Claude is down and I can't even get my chat history. Ouch.
150
If my brain contains a hundred trillion synaptic connections. And an 1T weight LLM can encode the whole Internet and every book ever written. Why can’t I remember more stuff?
1
36
Replying to @rubygems_status
@rubygems_status "Invalid spec cache file" for every gem command. Is that you?

