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
# Sometimes you need to reindex all Rails Models. The reindex() method | |
# is specific to the SearchKick gem for ElasticSearch, and it only exists | |
# on ElasticSearch-indexed tables. We do a check for its existence below, | |
# or it would throw an error. | |
Dir[Rails.root.join('app/models/*.rb').to_s].each do |filename| | |
klass = File.basename(filename, '.rb').camelize.constantize | |
next unless klass.ancestors.include?(ActiveRecord::Base) | |
next if klass.abstract_class? | |
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 Uuid | |
class << self | |
def valid?(uuid: uuid) | |
uuid =~ /^[\d\w]{8}-[\d\w]{4}-[\d\w]{4}-[\d\w]{4}-[\d\w]{12}$/i | |
end | |
end |
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
# Given a path on CODEOWNERS file, returns the username of code owner. | |
# CODEOWNERS file is either space or Tab-delimated. Hence the 2nd `cut` that slices on Tab. | |
# That's an actual Tab char between the ' '. It wouldn't accept '\t'. | |
# Here it is working on a Tab-deleimited line: | |
grep app/interactors/account/assign_reports_to/ .github/CODEOWNERS | cut -f2- -d ' ' | cut -f2- -d ' ' | |
# @templeman15 |
OlderNewer