Posts for: #Dev

Claude explained maps.Copy. Then I read the source.

I really like AI, and I love Claude. It is a great tool, particularly when it comes to learning or comparing approaches. It does a pretty good job of evaluating pros and cons, and providing me with explanations for them. All great, until recently.

The PR

In the context of a code change, in a BSON variable containing some file information, I had to include the parsed information extracted from the file name.

Read more →

Building a customizable Telegram bot in Go

Telegram bots are powerful tools for automating tasks and interacting with users. They are also easy to build and deploy, so it looked like a good idea to build one to play around with Go. This post will guide you through building a customizable Telegram bot. If you’d like to see the final code or simply go and grab the ready-to-use script to customize and run, you can find on GitHub. The setup and running instructions are included through the post.

Read more →

Another default_scope story

Rails default_scope is an ActiveRecord macro that allows you to set a default scope for all the operations on the model. This is useful to filter out records by default, such as soft deleted ones.

class User < ApplicationRecord
    default_scope { where(deleted_at: nil) }
end

In this way, we can filter out soft deleted users from all queries.

User.all
# SELECT * FROM users WHERE deleted_at IS NULL

This is a powerful tool, but it can lead to unexpected behavior. If you Google it, you will find a lot of examples. This is what I found out the hard way. On a Friday. Afternoon.

Read more →