I hereby claim:
- I am madebydna on github.
- I am andrea_singh (https://keybase.io/andrea_singh) on keybase.
- I have a public key ASABnGyvVjWQ_Aq1XYaqELkoXj8knsKY3I9uZGbY9wBJSQo
To claim this, I am signing this object:
#!/usr/bin/ruby | |
require 'pp' | |
f = File.open("input.txt", "r") | |
o = File.open("output.txt", "w+") | |
cases = f.readlines '' | |
cases.each do |c| | |
kase = c.split("\n").map{|i| i.split('')} | |
nl = kase[0] |
CS | |
Rt 135 | |
Fd 60 | |
REPEAT 2 [ Rt 90 Fd 150 ] | |
Rt 90 | |
Fd 60 | |
Rt 45 | |
Fd 128 |
module Logo | |
module Parser | |
def self.unroll_repeats(str) | |
str.gsub(/REPEAT (\d+) \[\s*(.*)\s*\]/) { |x| | |
$1.to_i.times.map { $2.strip }.join(" ") | |
} | |
end | |
def self.parse(source) | |
unroll_repeats(source).scan(/(RT|LT|FD|BK)\s+(\d+)/m) |
module Stockreturns | |
class Stockreturns | |
end | |
module Application | |
extend self | |
def run |
class ImportJob | |
include Sidekiq::Worker | |
sidekiq_options :queue => :import, :retry => false, :backtrace => true | |
def perform(project_id) | |
# create master batch | |
a = Sidekiq::Batch.new | |
a.description = "Master Batch A" | |
a.on(:success, "ImportJob#on_success", {"step" => "a"}) | |
logger.info "Master Batch A starting #{a.bid}" |
instructions = File.readlines("input_d2.txt").map(&:chomp!) | |
x, y = 0, 0 | |
instructions.each do |cmd| | |
direction, amt = cmd.match(/(forward|up|down) (\d+)/)[1..-1] | |
case direction | |
when "forward" | |
x += amt.to_i | |
when "up" | |
y -= amt.to_i |
I hereby claim:
To claim this, I am signing this object: