Skip to content

Instantly share code, notes, and snippets.

View bensheldon's full-sized avatar
🏊‍♂️
Swimming through code.

Ben Sheldon bensheldon

🏊‍♂️
Swimming through code.
View GitHub Profile
# frozen_string_literal: true
RSpec.shared_examples "strip normalizes text columns" do
it "strip normalizes text column values" do
text_columns = described_class.columns.filter_map do |col|
next unless [:text, :string].include?(col.sql_type_metadata.type)
next if described_class.defined_enums.key?(col.name)
attr_type = described_class.attribute_types[col.name]
#!/usr/bin/env ruby
require "fileutils"
# path to your application root.
APP_ROOT = File.expand_path("..", __dir__)
def system!(*args)
system(*args, exception: true)
end
FileUtils.chdir APP_ROOT do
Error in user YAML: (<unknown>): mapping values are not allowed in this context at line 2 column 113
---
name: interactive
description: Interactively run Ruby commands against a live Rails process using bin/interact. Supports two modes: a standalone server (bin/interactive) for general exploration, and binding.interactive breakpoints inside tests or app code to pause execution and inspect local state. Use when the user wants to explore live Rails objects, debug a test, or poke at a running process.
---

Interactively run Ruby commands against a live Rails process.

Task

$ARGUMENTS

name screenshot
description Takes screenshots at specific points in a system test using the Ruby debugger. Use when the user wants to capture screenshots of a UI flow or page state during a system test without modifying test files.

Take screenshots at specific points in a system test using the Ruby debugger to inject page.save_screenshot calls non-invasively.

Task

The user wants screenshots of: $ARGUMENTS

# frozen_string_literal: true
class TunePostgresJob < ApplicationJob
# Global autovacuum setting thresholds. If any global setting exceeds its threshold,
# apply the threshold value as a per-table override. If the global setting is already
# at or below the threshold, remove any per-table override so the global value applies.
AUTOVACUUM_SETTINGS = {
autovacuum_vacuum_scale_factor: 0.01,
autovacuum_analyze_scale_factor: 0.01,
autovacuum_vacuum_insert_scale_factor: 0.01,
# frozen_string_literal: true
require "fileutils"
# Helper for Git worktree-aware behavior
class GitWorktree
PROJECT_ROOT = File.expand_path("..", __dir__)
def self.instance = new
def self.name = instance.name
# frozen_string_literal: true
module I18nTaskYamlExt
UNMASKED_EMOJI = /
(?:
(?:\p{Emoji_Presentation}|\p{Emoji}\uFE0F) # base emoji
(?:\u200D(?:\p{Emoji_Presentation}|\p{Emoji}\uFE0F))* # + ZWJ parts
)
/ux
# frozen_string_literal: true
require "bundler/inline"
gemfile(true) do
source "https://rubygems.org"
gem "rails"
end
<% require_relative File.expand_path("git_worktree", __dir__) %>
default: &default
adapter: postgresql
encoding: unicode
pool: 20
connect_timeout: 5
checkout_timeout: 5
development:
const origDefine = customElements.define;
customElements.define = function(name, ctor, options) {
if (name !== 'turbo-cable-stream-source') return origDefine.call(this, name, ctor, options);
const proto = ctor.prototype;
const origDisconnectedCallback = proto.disconnectedCallback;
const origConnectedCallback = proto.connectedCallback;
proto.connectedCallback = async function() {
if (this.disconnecting) {