How to Set Hour and Minute for a Golang Time
Yes, sometimes we are surprised by Golang standard library! There is no method on time package that helps you to set (update) the hour, minute,… Read More »How to Set Hour and Minute for a Golang Time
Yes, sometimes we are surprised by Golang standard library! There is no method on time package that helps you to set (update) the hour, minute,… Read More »How to Set Hour and Minute for a Golang Time
If you are in a funny situation where you have to run a specific migration file on your Ruby on Rails project then this command… Read More »Rails Run or Redo Specific Migration
If you just need to have a minimal version of ruby on rails for your new project you are on the right page 🙂 Use… Read More »Rails: How to Start a New Minimal + API-Only Project?
fmt package is magic! I love it and you can use it to simplify many tasks especially the debugging process 🙂 Take a look at… Read More »Go: The Simplest Way to Dump complex Variables for Debugging
In Golang, there is no function to generate random numbers over a range! Writing a random generator function is easy and I wrote one for… Read More »How to Generate a Random Int Over a Range (func)
Oh we know the input format and we want to extract data from some exact position of that, Scanf from fmt package will help us:… Read More »Take a Formatted User Input in Golang (Extract Data)
You need to accept multiple inputs (with different types) from a user and all of them are in one line! Scanln from the fmt package… Read More »Go: How to Take Multiple User Inputs From One Line
Time package has a helper method to check a time.Time variable is zero value or not: Run this simple example to check how it works:
If your string contains some non-regular characters (like Chinese or Russian or currency signs) then you can calculate the length of your string using these… Read More »Go: How to Get the Length of a String With Non-regular Characters
On the response writer variable call the Header() method and then Set() to set the header you want to add: This snippet is complete and… Read More »Set Header to Response in Golang (HTTP Handler)