My configuration for IRB: highlight Rails.env

10+ years most with Ruby on Rails and JavaScript frontend and some Go. My first language is C for 3 years in university.
Search for a command to run...

10+ years most with Ruby on Rails and JavaScript frontend and some Go. My first language is C for 3 years in university.
"When it comes to crypto trading, it's important to find a platform that is genuine, secure, and reliable. (Adelynn Richardson fx on Instagram/Facebook) is a trusted and reputable platform that has been helping people to earn through crypto trading for many years. They have a proven track record of success, and their platform is designed to be safe and secure. Adelynn Richardson fx is committed to providing a transparent and user-friendly experience, so you can feel confident in your crypto trading journey."
I recently updated from Slim template to ERB to use Herb (Thanks Marco). I had to update a test that was very strict on the format. I realized that Capybara::Node::Simple doesn’t provide a selector for regex. The page object doesn’t have a match? met...

It is as simple as: rustup completions zsh > ~/.zfunc/_rustup rustup completions zsh cargo > ~/.zfunc/_cargo With a TAB you get the auto-complete or the options available: ❯ cargo b b -- alias: build bench -- Execute all benchmarks of a local ...
Let’s not re-write a good article, go to: https://joyofrails.com/articles/mastering-custom-configuration-in-rails I mostly used config.x configuration that loads a yaml file with config_for that do the multi-environment by default: module YourApp c...
No need to re-write the wheel, let me redirect to this great article from Lily Reile. Obviously still up-to-date and really useful as the official Rails doc is mostly showing the value before and after. https://lilyreile.medium.com/rails-6-1-new-fram...
I came around to update Appsignal gem to the new major version of Appsignal released at the end of August 2024: https://rubygems.org/gems/appsignal/versions/4.0.0 The upgrade was smooth. The real change for my application was to remove the parameter ...
Never forget the environment you are in.

# .irbrc
module ColorString
refine String do
def cyan = "\e[36m#{self}\e[0m"
def bg_red = "\e[41m#{self}\e[0m"
def bg_yellow = "\e[43m#{self}\e[0m"
def bg_green = "\e[42m#{self}\e[0m"
end
end
if defined?(Rails)
using ColorString
if Rails.env.production? || Rails.env.staging?
IRB.conf[:SAVE_HISTORY] = false
end
project_name = File.basename(Dir.pwd).cyan
environment = case Rails.env
when "development"
Rails.env.bg_green
when "staging"
Rails.env.bg_yellow
when "production"
Rails.env.bg_red
end
prompt = "#{project_name} [#{environment}]"
IRB.conf[:PROMPT] ||= {}
IRB.conf[:PROMPT][:RAILS] = {
PROMPT_I: "#{prompt} %03n > ",
PROMPT_S: "#{prompt} %03n * ",
PROMPT_C: "#{prompt} %03n ? ",
RETURN: "=> %s\n"
}
IRB.conf[:PROMPT_MODE] = :RAILS
end
begin
require "awesome_print"
AwesomePrint.irb!
rescue
end