ActiveSupport::Concern is a Rails built-in module which adds some magic to the plain Ruby Module. To take usage of it, a module should extend it: module M extend ActiveSupport::Concern end What kind of magic we talk about? It defines class_methods method which defines class methods from a given block: # A plain module module M def Read more…
Read more...Memo
Your first 90 days as CTO (article summary)
A summary of Your first 90 days as CTO by Will Lethain. Definitions of CTO and VP of Engineering differ across companies. Priorities for a brand new CTO vary; different priorities for a startup versus a mature company. Priorities and goals To figure them out Will defined some questions to ask yourself: How does the Read more…
Read more...`insert_all` and `upsert_all` ActiveRecord methods
TIL that since Rails 6 there have been quite new ActiveRecord bulk methods: insert_all and upsert_all. To better understand their powers, let’s quickly refresh our knowledge about INSERT and UPSERT SQL operations: INSERT is used to insert new records in a table. UPSERT either inserts or updates a row if it already exists. How do Read more…
Read more...dmesg, another tool in my toolbox
Today, thanks to @SzarekKrzysztof, one of the most experienced DevOps I know, I got familiar with another Unix operating system command called dmesg (diagnostic message). The command, according to Wikipedia, prints the message buffer of the kernel. Simply speaking, it displays the kernel-related messages on Unix systems. The output may be very helpful for diagnosing Read more…
Read more...Mysterious trio: DKIM, SPF and DMARC
If you haven’t implemented a feature which triggers sending an email to end-user so far the three acronyms may seem meaningless to you. I have and I often catch myself forgetting their meaning and importance. That’s why I decided to create this memo 🙂 They are email authentication methods. Thanks to them, domain owners can Read more…
Read more...Reverse engineering a bash command
Do you want to fully understand what a bash command with all its flag does? Give explainshell.com a try 🙂
Read more...Extending bash history limits
I use bash on a daily basis. From time to time I want to refer to a command that I executed in the past. Very often I start scrolling and terminal ends. As a result, I am not able to find the command 🤷 Thanks to When laziness is efficient: Make the most of your Read more…
Read more...The most effective way of iterating over CSV files in Ruby
A short recap after reading kinda oldish Processing large CSV files with Ruby. There are multiple ways of achieving the same result, but with different resources usages. If you want to iterate over CSV file in Ruby, CSV#foreach is your friend. CSV.foreach(‘data.csv’, headers: true).with_index do |row, i| puts “Row #{ i }: #{ row.join(‘,’) }” Read more…
Read more...