🏊♂️
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class BaseController < ApplicationController | |
include Flowable | |
self.form_flow = [ | |
"AppliesController", | |
# Initial "can we help you" questions | |
"Apply::LocationsController", | |
"Apply::RecentlyAppliedsController", | |
"Apply::LanguagesController", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<% require_relative File.expand_path("git_worktree", __dir__) %> | |
default: &default | |
adapter: postgresql | |
encoding: unicode | |
pool: 20 | |
connect_timeout: 5 | |
checkout_timeout: 5 | |
development: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# frozen_string_literal: true | |
# https://www.twilio.com/docs/glossary/what-is-gsm-7-character-encoding | |
class SmsCounter | |
MAX_SEGMENTS = 10 | |
GSM7_SINGLE_SEGMENT_LENGTH = 160 | |
GSM7_MULTI_SEGMENT_LENGTH = 153 | |
USC2_SINGLE_SEGMENT_LENGTH = 70 | |
USC2_MULTI_SEGMENT_LENGTH = 67 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Benchmark performance differences between "require" and "Autoload" | |
# | |
# $ for run in {1..3}; do ZEITWERK=0 AUTOLOAD=0 ruby scripts/autoload.rb && ZEITWERK=0 AUTOLOAD=1 ruby scripts/autoload.rb; done | |
# REQUIRE 0.208000 0.360310 0.568310 ( 0.568952) | |
# AUTOLOAD 0.242265 0.374332 0.616597 ( 0.617540) | |
# REQUIRE 0.214861 0.360820 0.575681 ( 0.576603) | |
# AUTOLOAD 0.225601 0.364912 0.590513 ( 0.590673) | |
# REQUIRE 0.214296 0.359103 0.573399 ( 0.574008) | |
# AUTOLOAD 0.224972 0.359481 0.584453 ( 0.584926) | |
# $ for run in {1..3}; do ZEITWERK=1 AUTOLOAD=0 ruby scripts/autoload.rb && ZEITWERK=1 AUTOLOAD=1 ruby scripts/autoload.rb; done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
❯ OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES bin/test test/application/loading_test.rb:560 | |
Run options: --seed 3148 | |
# Running: | |
/Users/bensheldon/Repositories/rails/rails/railties/test/application/loading_test.rb:571: warning: constant Gem::Specification::NOT_FOUND is deprecated | |
/Users/bensheldon/Repositories/rails/rails/railties/test/application/loading_test.rb:571: warning: constant Gem::RubyGemsVersion is deprecated | |
/Users/bensheldon/Repositories/rails/rails/railties/test/application/loading_test.rb:571: warning: constant Gem::ConfigMap is deprecated | |
/Users/bensheldon/Repositories/rails/rails/railties/test/application/loading_test.rb:571: warning: constant Gem::List is deprecated | |
/Users/bensheldon/Repositories/rails/rails/railties/test/application/loading_test.rb:571: warning: constant Gem::SpecificGemNotFoundException is deprecated |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Controller } from "@hotwired/stimulus" | |
import { debounce } from "lib/utils" | |
export default class extends Controller { | |
static values = { | |
resizeDebounceDelay: { | |
type: Number, | |
default: 100, | |
} | |
} |
NewerOlder