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
date = ARGV[0] | |
class Date | |
def self.valid?(date) | |
y, m, d = date.split '-' | |
date.match(/^\d{4}-\d{2}-\d{2}$/) && Date.valid_date?(y.to_i, m.to_i, d.to_i) | |
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
class Array | |
def flattener | |
arr = [] | |
self.each do |x| | |
if x.is_a? Array | |
arr = arr + x.flattener | |
else | |
arr << x | |
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
class Plateau | |
attr_accessor :max_x, :max_y, :direction | |
def initialize(x, y, direction = :n) | |
@max_x = x.to_i | |
@max_y = y.to_i | |
@direction = direction.downcase.to_sym | |
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
class Plateau | |
attr_accessor :max_x, :max_y, :direction | |
def initialize(x, y, direction = :n) | |
@max_x = x.to_i | |
@max_y = y.to_i | |
@direction = direction.downcase.to_sym | |
end | |
def land(position) |
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 'hexapdf' | |
doc = HexaPDF::Document.open("/home/xxxx/Downloads/OoPdfFormExample.pdf") | |
page = doc.pages[0] | |
canvas = page.canvas(type: :overlay) | |
canvas.translate(0, 20) do | |
canvas.fill_color(0.3, 0.7, 0.7) | |
canvas.rectangle(50, 0, 80, 80, radius: 80) |
OlderNewer