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
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
# Helper for Git worktree-aware behavior
module GitWorktree
PROJECT_ROOT = File.expand_path("..", __dir__)
def self.name
return @_name if defined?(@_name)
git_dir = `git rev-parse --git-dir 2>/dev/null`.strip
return @_name = nil if git_dir.empty? || git_dir.exclude?("/.git/worktrees/")
# 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) {
# frozen_string_literal: true
module TurboPermanentCableHelper
def turbo_permanent_stream_from(*streamables, **attributes)
raise ArgumentError, "streamables can't be blank" unless streamables.any?(&:present?)
raise ArgumentError, "an id is required" if attributes[:id].blank?
attributes[:channel] = attributes[:channel]&.to_s || "Turbo::StreamsChannel"
attributes[:'signed-stream-name'] = Turbo::StreamsChannel.signed_stream_name(streamables)
attributes[:data] ||= {}
attributes[:data][:turbo_permanent] = true
# frozen_string_literal: true
# config/initializers/view_component.rb
#
# Instantiate a ViewComponents that is (optionally) serializable by Active Job
# but otherwise behaves like a normal ViewComponent. This allows it to be passed
# as a renderable into `broadcast_action_later_to`.
#
# To use, include the `ViewComponent::Serializable` concern:
#
# class ApplicationComponent < ViewComponent::Base
class BaseController < ApplicationController
include Flowable
self.form_flow = [
"AppliesController",
# Initial "can we help you" questions
"Apply::LocationsController",
"Apply::RecentlyAppliedsController",
"Apply::LanguagesController",
<% require_relative File.expand_path("git_worktree", __dir__) %>
default: &default
adapter: postgresql
encoding: unicode
pool: 20
connect_timeout: 5
checkout_timeout: 5
development: