Skip to content

Instantly share code, notes, and snippets.

View smcabrera's full-sized avatar
🐶

Stephen Mariano Cabrera smcabrera

🐶
View GitHub Profile
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'
@smcabrera
smcabrera / pc-generator-mausritter.js
Created January 7, 2021 23:12
PC generator for mausritter
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]
@smcabrera
smcabrera / setting-up-linting-and-formatting-for-ruby-with-vs-code.md
Last active February 5, 2024 12:32
Setting up linting and auto-formatting for ruby with VS code

vs code configuration

#work/reference

Ruby linting vs code

Setting up vim bindings on VS code

Ruby plugin

  • Install solargraph gem so that you can get code completion
# 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")
@smcabrera
smcabrera / scratch.md
Last active July 6, 2017 17:56
tap, FP and cleverness

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

VIM!

Why Vim (or more accurately why vi)

  • Give those fingers a rest
    • vi allows you to stay on the home row for a lot of the time which is nice. No contorting your fingers
  • Get stuff done faster
  • SSH
  • Have more fun editing text