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
class SecretSanta | |
attr_reader :pairs | |
def initialize(filename) | |
@data = File.read(filename) | |
@list = @data.split("\r\n").map{|s| s.split("\t")} | |
end | |
def pick | |
@pairs = [] |
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/env ruby | |
base_dir = File.expand_path("../..", __FILE__) | |
NAME="faye" | |
PID="#{base_dir}/tmp/pids/#{NAME}.pid" | |
COMMAND="bundle exec rackup /home/deployer/apps/leveltravel/shared/config/faye.ru -s thin -E production" | |
case ARGV[0] | |
when "start" |
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
gm = Matcher.new(0) | |
Operator.pluck(:id).each do |o| | |
pansions = Matcher.new(o).list(:pansions).to_a.map{|e| [e[0].mb_chars.downcase, e[1]]}.to_h | |
pansions.each_pair do |k,v| | |
if gm.get(:pansion, k) | |
puts 'skip '+k | |
else | |
puts 'new '+k | |
gm.set(:pansion, k, v) | |
end |