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
# A Ruby On Rails script to delete files older than X days in a given directory. | |
# Quickly written by @coorasse | |
class FilesCleaner | |
def self.call(days = 1) | |
Dir.glob(Rails.root.join('path', 'to', 'folder', '*')).each do |filename| | |
File.delete(filename) if File.mtime(filename) < days.days.ago | |
end | |
end | |
end |
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
Raven.configure(true) do |config| | |
config.async = ->(event) { SentryJob.perform_later(event) } | |
end |
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
module FactoryGirl | |
module Syntax | |
module Methods | |
def find_or_create(name, attributes = {}, &block) | |
attributes = FactoryGirl.attributes_for(name).merge(attributes) | |
klass = FactoryGirl.factory_by_name(name).build_class | |
enums = klass.defined_enums | |
find_attributes = attributes.clone | |
find_attributes.keys.each do |key| |