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
require_dependency 'issue' | |
module MosregJoinEnabledModules | |
module Patches | |
module IssuePatch | |
def self.included(base) | |
base.class_eval do | |
scope :visible, lambda {|*args| | |
joins(project: :enabled_modules). | |
where(Issue.visible_condition(args.shift || User.current, *(args << {join_enabled_modules: true}))) |
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
del_keys = $redis.keys.select { |el| /\ACryptocompareClient:(BTC|ETH):USD:(\d{10})\z/.match(el).present?&&/\ACryptocompareClient:(BTC|ETH):USD:(\d{10})\z/.match(el)[2].to_i >= DateTime.parse('18-04-2018 00:00').to_i } | |
del_keys.each { |key| $redis.del(key) } | |
EthTransaction.all.each { |tr| tr.set_usd_amount } | |
BtcTransaction.all.each { |tr| tr.set_usd_amount } |
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 | |
require 'csv' | |
require 'ostruct' | |
#require 'date' | |
filename = 'movies.txt' | |
keys_array = %i[href name year country date genres duration rank director actors] | |
films_array =[] |
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 | |
filename = 'movies.txt' | |
keys_array = %i[href name year country date genres duration rank director actors] | |
films_array =[] | |
def output_films (arr) | |
arr.each do |film| | |
puts "#{film[:name]} :(#{film[:date]} ; #{film[:genres]}) - #{film[:duration]}" |
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 | |
filename = 'movies.txt' | |
name_template = 'Max' | |
name_index = 1 | |
rating_index = 7 | |
file = "" | |
filename = ARGV[0] || filename |
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 | |
bad_films = ['Titanic', 'Alien 18'] | |
good_films = ['Matrix', 'Interstate 60'] | |
puts case | |
when good_films.map(&:downcase).include?(ARGV[0].downcase) then "#{ARGV[0]} is a good movie." | |
when bad_films.map(&:downcase).include?(ARGV[0].downcase) then "#{ARGV[0]} is a bad movie." | |
else "Haven't seen #{ARGV[0]} yet" | |
end |