Skip to content

Instantly share code, notes, and snippets.

View SamMolokanov's full-sized avatar
💭
🌻

Semjon Molokanov SamMolokanov

💭
🌻
  • Canada
View GitHub Profile
@SamMolokanov
SamMolokanov / arel_helpers.rb
Created April 28, 2022 15:42 — forked from hadees/arel_helpers.rb
Arel Helpers
module ArelHelpers
extend self
def self.included(base)
base.extend self
end
def asterisk(arel_table_or_model)
arel_table, columns = case arel_table_or_model
when Arel::Table
@SamMolokanov
SamMolokanov / Output:
Last active February 21, 2019 13:11
Running Rspec tests multiple times with different configuration
$rspec spec/examples/multiple/foo_spec.rb -f d
Randomized with seed 62690
Foo
has one of available values
has one of available values
has one of available values
Finished in 0.03669 seconds
@SamMolokanov
SamMolokanov / Readme.md
Last active January 26, 2024 23:57
Custom sprockets compressor as proxy skips minified assets

Proposal

Many modern Rails application use third-party assets like JavaScript and CSS libraries or frameworks. In most cases these assets are minified and compressed by tools outside of the Rails asset pipeline. For example popular gem React on Rails uses WebPack to build JavaScript bundles. When we include these files to assets pipeline it goes to minify again. We can safely avoid double minification and reduce assets compilation time. Meanwhile it is still good to add a digest and gzip compression.

Example

Savings are strongly depend on how many minified assets are used in an application, some numbers for a random application:

# standard setup