This file contains hidden or 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
This is a hello world post. |
This file contains hidden or 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
module Madriska | |
module Prawn | |
module ColumnLayout | |
# doc.columns %w[70 50% * *] do | |
# doc.column { doc.text "70pt wide" } | |
# doc.column { doc.text "50% of container" } | |
# doc.column { doc.text "Split the remainder" } | |
# doc.column { doc.text "Split the remainder" } | |
# end |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or 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
doc.font_families.update( | |
"DejaVu Sans" => { | |
:normal => font_path('DejaVuSans.ttf'), | |
:bold => font_path('DejaVuSans-Bold.ttf'), | |
:oblique => font_path('DejaVuSans-Oblique.ttf') | |
} | |
) |
This file contains hidden or 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/local/lib/ruby/gems/1.8/gems/prawn-0.4.0/lib/prawn/document/internals.rb:44:in `proc_set': undefined method `data' for nil:NilClass (NoMethodError) | |
from /usr/local/lib/ruby/gems/1.8/gems/prawn-0.4.0/lib/prawn/font.rb:203:in `initialize' | |
from /usr/local/lib/ruby/gems/1.8/gems/prawn-0.4.0/lib/prawn/font/afm.rb:30:in `initialize' | |
from /usr/local/lib/ruby/gems/1.8/gems/prawn-0.4.0/lib/prawn/font.rb:192:in `new' | |
from /usr/local/lib/ruby/gems/1.8/gems/prawn-0.4.0/lib/prawn/font.rb:192:in `load' | |
from /usr/local/lib/ruby/gems/1.8/gems/prawn-0.4.0/lib/prawn/font.rb:125:in `find_font' | |
from /usr/local/lib/ruby/gems/1.8/gems/prawn-0.4.0/lib/prawn/font.rb:33:in `font' | |
from font_test.rb:4 | |
from /usr/local/lib/ruby/gems/1.8/gems/prawn-0.4.0/lib/prawn/document.rb:115:in `instance_eval' | |
from /usr/local/lib/ruby/gems/1.8/gems/prawn-0.4.0/lib/prawn/document.rb:115:in `initialize' |
This file contains hidden or 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 'prawn' | |
Prawn::Document.generate('font_test.pdf') do | |
font "Helvetica", :style => :bold | |
text "Bold" | |
start_new_page | |
text "This should be bold" | |
end |
This file contains hidden or 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
# Cantor-numbering: maps Integer onto (Integer,Integer) | |
def cantor(z) | |
w = ((Math.sqrt(8*z+1)-1) / 2).floor | |
t = ((w**2 + w) / 2).floor | |
y = z-t | |
x = w-y | |
[x,y] | |
end | |
# Iterates over the Cartesian product xs*ys in Cantor order |
This file contains hidden or 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
>> RUBY_VERSION | |
=> "1.9.1" | |
>> Rational(Rational(1,2),Rational(3,4)).inspect | |
=> "(2/3)" | |
>> RUBY_VERSION | |
=> "1.8.6" | |
>> Rational(Rational(1,2),Rational(3,4)).inspect | |
NoMethodError: undefined method `gcd' for Rational(1, 2):Rational | |
from /usr/local/lib/ruby/1.8/rational.rb:78:in `reduce' |
This file contains hidden or 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
>> RUBY_VERSION | |
=> "1.8.6" | |
>> Date.parse('1/2/2009').to_s | |
=> "2009-01-02" # one of these things is not like the other | |
>> Date.parse('1-2-2009').to_s | |
=> "2009-02-01" | |
>> RUBY_VERSION | |
=> "1.9.1" |
This file contains hidden or 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
def login_required | |
authorized? || access_denied | |
end | |
def access_denied | |
respond_to do |format| | |
format.html do | |
store_location | |
redirect_to new_session_path | |
end |
OlderNewer