I hereby claim:
- I am hopsoft on github.
- I am hopsoft (https://keybase.io/hopsoft) on keybase.
- I have a public key ASCUrC24sEgI229zKeQ2yFjvNYN6NEHRunnG0LMQD050Iwo
To claim this, I am signing this object:
# frozen_string_literal: true | |
module Broadcastable | |
extend ActiveSupport::Concern | |
def prepend_operation(options = {}) | |
operation = {html: ApplicationController.render(partial: to_partial_path, locals: locals)} | |
operation.merge options | |
end |
module ThreadAwareEquality | |
refine BasicObject do | |
alias_method :original_equals, :== | |
def ==(other) | |
Thread.current[:actual] = self | |
Thread.current[:expected] = other | |
original_equals other | |
end | |
end |
I hereby claim:
To claim this, I am signing this object:
<%= f.select :country_codes, country_select_data, {}, {multiple: true, data: { | |
controller: "select", action: "stimulus-reflex:after@document->select#delayedSetup", reflex: "change->Adapter#assign_attributes"}} %> |
module ActionControllerParameters | |
def filtered | |
filter_hash self.to_unsafe_hash | |
end | |
private | |
def filterer | |
@filterer ||= ActionDispatch::Http::ParameterFilter.new(Rails.application.config.filter_parameters) | |
end |
Simply ordering your table's columnns for more efficient datatype storage can save up to 30% of disk utilization.
<%= select_tag column_name, | |
options_for_select(...), { | |
multiple: true, | |
placeholder: "Select multiple...", | |
data: { | |
controller: "select", | |
action: "stimulus-reflex:after@document->select#delayedSetup", | |
options_url: typeahead_path(...) | |
}} %> |
# frozen_string_literal: true | |
module ModelSupportsBulkUpdates | |
extend ActiveSupport::Concern | |
module ClassMethods | |
# Performs a bulk update with an efficient single query for all the records in the list. | |
# Note that the records are not reloaded form the database. | |
# This means that ActiveRecord will still see these records as dirty after the bulk_update. | |
def bulk_update(records) |
require "benchmark" | |
require "active_support/all" | |
Benchmark.bm do |x| | |
count = 1_000_000 | |
label_size = 20 | |
x.report "check for nil:".rjust(label_size) do | |
count.times { nil && nil.length } | |
end |