For reference only:
- rtx-cli
- Ruby 3.2.0
- Most dependencies installed via Homebrew
- macOS 14.2.1
- M3 Max chip
# Block things on LinkedIn with uBlock Origin that LinkedIn won't let you block | |
# Choose "Options" in uBlock Origin with a right-click, and add these to | |
# "My filters" | |
# ADDING YOUR OWN FILTERS | |
# | |
# Using Linkedin.com as an example | |
# | |
# 1. Open up the webpage | |
# 2. Find some text you want to block |
# app/models/user.rb | |
# | |
class User | |
after_create :foo | |
private | |
def foo | |
# ..something we don't do very often | |
end |
For some reason, I couldn't get the annotate gem to remove the file annotations | |
I used SublimeText w/ the following regex: | |
Find: `(?s)# == Schema Information\n(.*?)\n((# :nodoc:\n)?class)` | |
Replace: `class` (just adds back what I grabbed above) |
For reference only:
If your Gemfile has a privately hosted package referenced similar to this:
gem 'sekret', git: 'https://github.com/my-private-group/sekret.git', branch: 'main'
You may see a prompt when running bundle install
, or other bundler commands, to enter your github username & password.
To resolve this, you need to generate a token and add it to your system.
require 'base64' | |
file = File.open('path/to/file.ext', 'rb') # Read the image as binary | |
base64 = Base64.strict_encode64(file.read) # This gives you a string you can assign to a constant/variable | |
tmpfile = Tempfile.new(Base64.strict_decode64(base64)) # Decode and create a temporary file | |
Digest::MD5.file(tmpfile).base64digest # This is one way to create a checksum on the file | |
File.size(tmpfile) # You can also get a file size |
# frozen_string_literal: true | |
class MyStuff | |
OOPS = 'Oops' | |
def self.call | |
Rails.logger.warn { OOPS } | |
end | |
end |
# Lines marked with pry are just for testing in a rails console | |
require 'rspec/mocks' # pry | |
include RSpec::Mocks::ExampleMethods # pry | |
# This bypasses the warning that the method isn't called inside of a test | |
RSpec::Mocks.with_temporary_scope do # pry | |
stub_const( | |
'MyClass', | |
instance_double( |
libgirepository-1.0-1 | |
libgirepository1.0-dev | |
libpoppler-glib-dev |
# An example of class/instance methods w/ modules | |
module Foo | |
def self.included(base) | |
base.extend(ClassMethods) | |
end | |
def foo | |
puts 'Bar.new.foo prints this' | |
end |