Skip to content

Instantly share code, notes, and snippets.

View mat813's full-sized avatar

Mathieu Arnold mat813

View GitHub Profile
def lines_grid(s1=10, s2=100)
save_graphics_state do
stroke_color('EEEEEE')
fill_color('000000')
stroke do
line_width(0.5)
0.step(bounds.right, s1).each do |i|
line([i, 0], [i, bounds.top]) if (i%s2 != 0)
end
0.step(bounds.top, s1).each do |i|
def stretch_box(ratio, point, options, &block)
x, y = if ratio.is_a?(Array)
ratio.map(&:to_f)
else
[ratio.to_f, 1.0]
end
options[:width] = options[:width] / x
options[:height] = options[:height] / y if options.key?(:height)
point[0] += bounds.absolute_left
point[1] += bounds.absolute_bottom
module Jekyll
module Filters
def summarize(str, splitstr = /\s*<div id="extended">/)
str.split(splitstr)[0]
end
end
end