Skip to content

Instantly share code, notes, and snippets.

View veganstraightedge's full-sized avatar
🐢
Computers were a mistake.

Shane Becker veganstraightedge

🐢
Computers were a mistake.
View GitHub Profile
@veganstraightedge
veganstraightedge / pascals_triangle.rb
Last active July 30, 2025 07:03
After watching a couple Numberphile videos on YouTube about Catalan Numbers and Pascal's Triangle, I wrote a Pascal's Triangle implementation in Ruby as a fun little exercise. https://youtu.be/fczN0BCx0xs https://youtu.be/0iMtlus-afo
def pascals_triangle total_rows=3, start_value=1
rows = []
(total_rows + 1).times do |current_row|
if current_row == 1
rows << [nil, start_value]
next
end
row = [nil]
Prefix Description Notes
ac_ Platform Client ID Identifier for an auth code/client id.
acct_ Account ID Identifier for an Account object.
aliacc_ Alipay Account ID Identifier for an Alipay account.
ba_ Bank Account ID Identifier for a Bank Account object.
btok_ Bank Token ID Identifier for a Bank Token object.
card_ Card ID Identifier for a Card object.
cbtxn_ Customer Balance Transaction ID Identifier for a Customer Balance Transaction object.
ch_ Charge ID Identifier for a Charge object.
cn_ Credit Note ID Identifier for a Credit Note object.
@veganstraightedge
veganstraightedge / crop_export_subimages.rb
Last active November 18, 2023 05:56
REQUIRES `imagemagick` installed. ONLY TESTED ON MY LAPTOP. BUYER BEWARE! Export four individual image files from one source image file. (Source is one big file from entire flatbed scanner or four Polaroids. Each individual Polaroid gets exported to its own file.)
source_files = ARGV[0]
# optional file type args
# passed in like: ruby crop.rb path/to/files source_extension export_extension
# ruby crop.rb path/to/files heic png
source_extension_arg = ARGV[1]
export_extension_arg = ARGV[2]
# both extensions default to heic if not passed in
SOURCE_EXTENSION = source_extension_arg.nil? ? "heic" : source_extension_arg
@veganstraightedge
veganstraightedge / update_outdated_gems.rb
Created November 4, 2021 17:26
If you can't use Dependabot (or something like it) for some reasons, you can be a DependaHuman by running this script in two parts. First copy/paste line 11 to your Terminal. Then copy that output from the Terminal into the bottom of this script under that `__END__` and run the script.
# Command to run:
# bundle outdated --parseable
# OR:
# bundle outdated --strict --parseable
# OR:
# bundle outdated --strict --parseable --filter-patch;
# bundle outdated --strict --parseable --filter-minor;
# bundle outdated --strict --parseable --filter-major;
# OR as one line:
=begin
@veganstraightedge
veganstraightedge / rails_date_select_bootstrap.html.erb
Created October 24, 2021 00:24
This is how I use a date_select or datetime_select helper in a Rails ERB view with Bootstrap classes, so it looks Bootstrappy but also all on one line.
<div class='mb-3'>
<%= form.label :birthday, class: 'form-label' %>
<div>
<%= form.date_select :birthday,
{
prompt: true,
add_month_numbers: true,
end_year: Time.now.year - 111,
start_year: Time.now.year - 12,
on: [push]
name: License Finder
jobs:
run:
runs-on: ubuntu-latest
steps:
- name: Checkout
@veganstraightedge
veganstraightedge / ruby_2_7_1_easter_egg.txt
Last active April 13, 2020 17:41
`IRB.send :easter_egg`
-+smJYYN?mm-
HB"BBYT TQg NggT
9Q+g Nm,T 8g NJW
YS+ N2NJ"Sg N?
BQg #( gT Nggggk J
5j NJ NJ NNge
#Q #JJ NgT N(
@j bj mT J
Bj @/d NJ (
#q #(( NgT #J
@veganstraightedge
veganstraightedge / _opinions.md
Last active June 29, 2019 23:00
StandardRB and I think different things are better. ¯\_(ツ)_/¯

TO MY EYES, the first is worse than the second.

@veganstraightedge
veganstraightedge / rails__credentials_edit__error.txt
Created March 2, 2019 23:38
In a fresh Rails 5.2 app, `rails credentials:edit` works as advertised. In my Rails 5.2 app, something has been changed and `rails credentials:edit` doesn't work. It gives the error below. I can't find what change caused this.
activesupport-5.2.2/lib/active_support/message_encryptor.rb:206:
in `rescue in _decrypt':
ActiveSupport::MessageEncryptor::InvalidMessage (ActiveSupport::MessageEncryptor::InvalidMessage)
1: from activesupport-5.2.2/lib/active_support/message_encryptor.rb:183:in `_decrypt'
2: from activesupport-5.2.2/lib/active_support/message_encryptor.rb:157:in `decrypt_and_verify'
3: from activesupport-5.2.2/lib/active_support/messages/rotator.rb:21:in `decrypt_and_verify'
4: from activesupport-5.2.2/lib/active_support/encrypted_file.rb:79:in `decrypt'
5: from activesupport-5.2.2/lib/active_support/encrypted_file.rb:42:in `read'
6: from activesupport-5.2.2/lib/active_support/encrypted_configuration.rb:21:in `read'
WARN: Unresolved specs during Gem::Specification.reset:
rack (< 3, >= 1.4.5)
parallel (>= 0)
activesupport (< 5.1, >= 3.1, >= 4.2)
addressable (~> 2.3)
rb-inotify (>= 0.9.7, ~> 0.9)
concurrent-ruby (~> 1.0)
fastimage (~> 2.0)
rake (>= 0)
hashie (~> 3.4)