- display top 20 largest folders
du -ah . | sort -rh | head -20- display total volume
du -hs /path/to/directory| # frozen_string_literal: true | |
| # rubocop:disable Style/DocumentDynamicEvalDefinition, Naming/PredicateName | |
| # This monkey-patching is for applying scope for association | |
| # example: | |
| # has_many_attached images, -> { order(created_at: :desc) } | |
| module ActiveStorage | |
| class Attached | |
| module Model | |
| extend ActiveSupport::Concern |
| # frozen_string_literal: true | |
| # This monkey-patching is for creating records using url | |
| # instead of reupload the file using attach of activestorage | |
| # this is useful for SPA | |
| module ActiveStorage | |
| module BlobParser | |
| def parse_blob(attachable) | |
| key, filename, content_type = parse_url(attachable) | |
| io = URI.parse(attachable).open |
du -ah . | sort -rh | head -20 du -hs /path/to/directory| def do_request(http_method: nil, action: nil, params: {}, **extra_params) | |
| if http_method.blank? || action.blank? | |
| http_method, action = self.class.metadata[:full_description].split[1..2] | |
| action.delete!('#') | |
| end | |
| send(http_method.downcase.to_sym, action.to_sym, params: params.merge(extra_params)) | |
| end | |
| =begin |
find all comments except for frozen_string_literal comment
/((([^\w\d:;\t\r\n]\s?)|^\s?)#\s?(?!.*(frozen_string_literal:|rubocop:(disable|enable))).+)|(^=begin(.|\n)+?(?==end)=end)/gmfind all comments except for eslint comments
/((([^\w\d:;\t\r\n]\s?)|^\s?)\/\/\s?(?!.*(eslint-disable)).+)|(\/\*((.|\n)((?!(eslint-(disable|enable)))))+?(?=\*\/)\*\/)/gm