ruby 3.1.4p223 (2023-03-30 revision 957bb7cb81) [x86_64-darwin21]
Warming up --------------------------------------
concatenation 449.658k i/100ms
array join 249.847k i/100ms
Calculating -------------------------------------
concatenation 4.375M (± 2.5%) i/s - 22.033M in 5.039031s
array join 2.508M (± 4.3%) i/s - 12.742M in 5.090572s
Comparison:
This file contains 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 Form | |
class BaseComponent < ApplicationComponent | |
class << self | |
attr_accessor :default_options | |
end | |
include Components::Validations |
This file contains 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
// Loads stimulus controllers from ../components/ folder | |
// | |
// Normal output: | |
// button/button_controller.js => data-controller="button--button" | |
// form/text_field/text_field_controller.js => data-controller="form--text-field--text-field" | |
// | |
// Expected output: | |
// button/button_controller.js => data-controller="button" | |
// form/text_field/text_field_controller.js => data-controller="form--text-field" |
My issue was about ordering and pagination. I was ordering a query on a column (of_the_moment_weight
) that could have multi times the same value. Tehcnically, all entries could have the same value.
The result is that some entry appear on multiple page. But it shouldn't be the case.
Use two columns for ordering.
🚀 I create the
dekorator
gem if this interrest you.
Copy ApplicationDecorator
inside app/decorators/application_decorator.rb
and DecoratorsHelper
inside decorators_helper.rb
.
Then you could create and use your own decorators by create new class that extend from ApplicationDecorator
.
This file contains 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
#!/usr/bin/env ruby | |
# frozen_string_literal: true | |
# USAGE: | |
# $ ./list_dependencies.rb | |
# $ ./list_dependencies.rb /path/to/project | |
# | |
# @see: https://stackoverflow.com/questions/44681231/how-to-list-ruby-production-only-dependencies-using-gemfile-lock-and-lockfilepar |
This file contains 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 ActiveStorage | |
module Validations | |
class FileSizeValidator < ActiveModel::EachValidator | |
include ActiveSupport::NumberHelper | |
MESSAGES = { minimum: :file_size_too_short, maximum: :file_size_too_long }.freeze | |
CHECKS = { minimum: :>=, maximum: :<= }.freeze |
This file contains 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 Mailcatcher < Formula | |
desc "Catches mail and serves it through a dream." | |
homepage "https://github.com/sj26/mailcatcher" | |
url "https://github.com/sj26/mailcatcher/archive/v0.6.5.zip" | |
sha256 "393303738ec6c7e0254b22b3f6b8f7988363791890516f820e90372afef4d65c" | |
version "0.6.5" | |
def install | |
ENV["GEM_HOME"] = libexec | |
system "gem", "build", "mailcatcher.gemspec" |
NewerOlder