Adding a script (or custom code) to head in WordPress

Question What is the easiest way to add a script to head in WordPress? You often need to add a custom <script> inside <head>. For example it’s a simple way to add Google Analytics, tracking, syntax highlighting, custom JS libraries, etc. I know…

How to set the page title in Ruby on Rails

Question What is the correct way to set the page title in Rails? In a Ruby on Rails application, what is the recommended way to set the page title? For example, in the application layout you have: How do you…

All you need is 1 favicon

Question What favicon sizes should I use in 2022? In the past I have always used this website to generate all the favicon sizes: However I wonder if it’s still necessary in 2022 to include all those favicons… It’s…

Heroku: how to create daily database backups for free

Question Can I have database backups on Heroku free plan? I have a database in the entry / free tier on Heroku. Is there any way to have automatic backups (e.g. daily backups)? Answer You don’t need a paid plain…

Git: how to rename branch master to main

Question How can I rename git branch master to main? I see that many projects are moving from master to main. What is the easiest way to rename the master branch to main? How can I rename it also on the Github repo without breaking things?…

Kubernetes: restart the pods of all deployments

Question How can I restart all pods in a Kubernetes cluster? Is there a simple command to restart all pods in a Kubernetes cluster? For example if you run a Rails migration on the database (rails db:migrate), then you need…

Convert DateTime into Date in Ruby on Rails

Question How can I transform a DateTime into a Date in Ruby on Rails? In a Ruby on Rails application I have the created_at column. Now I want to print it: However that prints something like Posted on 05 Dec 12:34, which includes…

How to create a label inside an input with HTML and CSS

Question How can I create a label inside an input? I would like to add a gray text inside an input field that disappears when the user clicks on the field and starts typing. Do I need JavaScript or I can simply…