TIL Variable hoisting in ruby
I might be still continue declaring explicity as it gives more clarity to me but still good to know about hoisting in ruby :)
You can read more here: https://ieftimov.com/posts/variable-hoisting-ruby/
TIL about 'bin/rails runner' in Rails
TIL in Ruby: `arity`
Returns the number of mandatory arguments.
If the block is declared to take no arguments, returns 0.
If the block is known to take exactly n arguments, returns n.
If the block has optional arguments, returns -n-1
[Ruby][Rails] Learned about a new gem decent_exposure
TIL about PostgreSQL follower database in Heroku
TIL in Flutter, we can specify the app version and build number in pubspec.yaml

TIL in Javascript, Date `getMonth()` does not give the correct month as we expect 🤯
today = new Date() Thu May 05 2022 19:28:34 GMT+0530 (India Standard Time) today.getMonth() 4
what! it should be 5 (May!)
looks like the return values are from 0 to 11
so for now we'll have to do today.getMonth() + 1 to get correct month value
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/getMonth#return_value
TIL we can compare versions in Ruby using `Gem::Version` without any gems
Gem::Version.new('1.0.1') > Gem::Version.new('1.0.0')
Here is the link to the documentation: https://ruby-doc.org/stdlib-3.1.0/libdoc/rubygems/rdoc/Gem/Version.html
TIL How to change screenshot directory in macOS
defaults write com.apple.screencapture location {location here}
e.g,
defaults write com.apple.screencapture location /Users/rinas/Desktop/Screenshots
TIL in Rails: Code after redirect_to gets executed
redirect_to url and return
Here is the issue which talks about this: https://github.com/rails/rails/issues/26363
TIL about using counter_cache in rails to save association's count in parent model
Here is the SO answer that helped: https://stackoverflow.com/a/16996960/3098242

TIL how to select values from one column without `nil` in Rails
Page.where.not(custom_domain: nil).pluck(:custom_domain)
---------------------------------------
Page.pluck(:custom_domain)

`.pluck` picks values but includes `nil` as well. So we can use `.compact`
Page.pluck(:custom_domain).compact

TIL How to change progress bar colour in Rails
TIL what policy to use for AWS S3 to work with Rails Active Storage

TIL how to colour console logs
console.log('%c hey red text', 'color: red') console.log('%c hey green text', 'color: green')
