#rails #minitest #testing
Add to test/test_helper.rb
def with_cache
@original_cache_store = Rails.cache
Rails.cache = ActiveSupport::Cache::MemoryStore.new
yield
ensure
Rails.cache = @original_cache_store
inherit_gem: | |
rubocop-rails-omakase: rubocop.yml | |
require: | |
- rubocop-performance | |
- rubocop-rails | |
AllCops: | |
NewCops: enable | |
TargetRubyVersion: 3.3 |
Since you can't update Stripe API version on a webhook, the only way to do it, is to disable one, and create a new one. |
#rails #minitest #testing
Add to test/test_helper.rb
def with_cache
@original_cache_store = Rails.cache
Rails.cache = ActiveSupport::Cache::MemoryStore.new
yield
ensure
Rails.cache = @original_cache_store
#rails #actionmailer #callbacks
Callbacks for mailers are implemented using AbstractController::Callbacks
.
This has a terminator lambda: https://github.com/rails/rails/blob/6af9cba73db6296ab9aec7dbeae1e193ea69f09f/actionpack/lib/abstract_controller/callbacks.rb#L34
AbstractController::Base
defines performed?
as: return response_body
https://github.com/rails/rails/blob/6af9cba73db6296ab9aec7dbeae1e193ea69f09f/actionpack/lib/abstract_controller/base.rb#L188
So - as soon as we set any response body, no other callbacks or actions will occur.
javascript: Promise.all([ | |
import("https://unpkg.com/[email protected]?module"), | |
import("https://unpkg.com/@tehshrike/[email protected]"), | |
]).then(([{ default: Turndown }, { default: Readability }]) => { | |
const vault = ""; | |
const folder = "quick"; | |
const tags = "#clippings"; | |
function getSelectionHtml() { | |
var html = ""; |
loop do | |
puts "Gimme photo\n" | |
path = gets | |
exifdata = value = `exiftool -c "%+.10f" #{path} ` | |
line = exifdata.split("\n").find{|l| l.include?("GPS Position")} | |
if line.nil? | |
puts exifdata | |
puts "\nNO GPS 🤷♂️" | |
else |
require 'benchmark/ips' | |
Benchmark.ips do |x| | |
records = [] | |
10_000.times do |i| | |
records << "#{['abc', 'rec', 'air'].sample}-#{i}-#{['abc', 'rec', 'air'].sample}-#{i}" | |
end | |
AIRTABLE_ID_REGEX = /rec(?!_)/.freeze |
{"quotes":[{"text":"We have two ears and one mouth, so we should listen more than we say.","author":"Zeno of Citium, as quoted by Diogenes Laërtius"},{"text":"Man conquers the world by conquering himself.","author":"Zeno of Citium"},{"text":"The goal of life is living in agreement with Nature.","author":"Zeno"},{"text":"if being is many, it must be both like and unlike, and this is impossible, for neither can the like be unlike, nor the unlike like","author":"Zeno"},{"text":"Well-being is attained little by little, and nevertheless is no little thing itself.","author":"Zeno of Citium"},{"text":"The reason why we have two ears and only one mouth is that we may listen the more and talk the less.","author":"Zeno"},{"text":"When a dog is tied to a cart, if it wants to follow, it is pulled and follows, making its spontaneous act coincide with necessity. But if the dog does not follow, it will be compelled in any case. So it is with men too: even if they don't want to, they will be compelled to follow what is desti |
.DS_Store |
# frozen_string_literal: true | |
source 'https://rubygems.org' | |
gem 'sinatra' | |
gem 'twentysix' |