#work/reference
Ruby linting vs code
Setting up vim bindings on VS code
Ruby plugin
- Install
solargraphgem so that you can get code completion
| #!/usr/bin/env ruby | |
| require 'fileutils' | |
| require 'active_support/core_ext/string' # For underscore method | |
| # Function to extract the migration class name from the file path | |
| def extract_migration_class_name(file_path) | |
| migration_file_name = File.basename(file_path, '.rb') | |
| # Convert the rest of the filename (after timestamp) to CamelCase |
| Based on https://conventionalcomments.org/ | |
| **issue (blocking, non-blocking or if-minor):** ❗ subject | |
| Issues highlight specific problems with the subject under review. These problems can be user-facing or behind the scenes. It is strongly recommended to pair this comment with a suggestion. If you are not sure if a problem exists or not, consider leaving a question. | |
| **nitpick**: 💅 subject | |
| Nitpicks are trivial preference-based requests. These should be non-blocking by nature. |
| alias remup='current_branch=$(git branch | grep \* | cut -d " " -f2) ; git checkout main ; git fetch ; git pull origin main ; git checkout $current_branch ; git merge main' |
| let strength = new Roll("3d6k2").roll().total; | |
| let dexterity = new Roll("3d6k2").roll().total; | |
| let will = new Roll("3d6k2").roll().total; | |
| let hp = new Roll("1d6").roll().total | |
| let pips = new Roll("1d6").roll().total | |
| const characterName = "New Maus" | |
| const birthsignWithDetails = game.tables.entities.find(t => t.name === "Birthsign").roll().results[0].text | |
| const birthsign = birthsignWithDetails.match(/(.*)\:/)[1] |
| # Dev show and tell | |
| #work/canvas | |
| Shell stuff! 🐢 🐚 | |
| - iterm2 > terminal.app | |
| - Check out the preferences. There’s a _ton_ of stuff in there | |
| Preferences -> profiles -> advanced -> trigger |
| # frozen_string_literal: true | |
| "some string".gsub!("some", "different") | |
| # Traceback (most recent call last): | |
| # 1: from string.rb:3:in `<main>' | |
| # string.rb:3:in `gsub!': can't modify frozen String (FrozenError) |
| FIRST_ARRAY = [ | |
| FIRST_CONSTANT = "first constant value", | |
| SECOND_CONSTANT = "second constant value" | |
| ].freeze | |
| SECOND_ARRAY = [ | |
| FIRST_CONSTANT = "first constant value REDEFINED!!!!", | |
| SECOND_CONSTANT = "DANGER" | |
| ].freeze |
| #!/usr/bin/env ruby | |
| # frozen_string_literal: true | |
| ARGV.each do |original_file| | |
| unless File.exist? original_file | |
| puts "#{original_file} does not exist" | |
| next | |
| end | |
| timestamp = Time.now.utc.strftime("%Y%m%d%s") |
For your consideration
ServiceResult.new(grant_applications: grant_applications)
def create_grant_applications
grant_program.new_eligible_users
.map { |user| user.grant_applications.build(grant_program: grant_program) }
.map { |grant_application| grant_application.save!(skip_validations: true) }
end