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
Prawn::Document.generate('labels.pdf', :left_margin => 0.21975.in, :right_margin => 0.21975.in) do |p| | |
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
Prawn::Document.generate('labels.pdf', :left_margin => 0.21975.in, :right_margin => 0.21975.in) do |p| | |
p.define_grid(:columns => 3, :rows => 10, :column_gutter => 10) | |
p.grid.rows.times do |i| | |
p.grid.columns.times do |j| | |
b = p.grid(i,j) | |
p.bounding_box b.top_left, :width => b.width, :height => b.height do | |
p.text b.name | |
p.stroke do | |
p.rectangle(p.bounds.top_left, b.width, b.height) |
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
Prawn::Document.generate('labels.pdf', :left_margin => 0.21975.in, :right_margin => 0.21975.in) do |p| | |
p.define_grid(:columns => 3, :rows => 10, :column_gutter => 10) | |
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
## Controller | |
prawnto :prawn => {:left_margin => 0.21975.in, | |
:right_margin => 0.21975.in} | |
## View | |
pdf.define_grid(:columns => 3, :rows => 10, :column_gutter => 10) | |
pdf.grid.rows.times do |i| | |
pdf.grid.columns.times do |j| | |
b = pdf.grid(i,j) |
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
Prawn::Document.generate('box.pdf') do |p| | |
p.stroke do | |
p.rectangle([100,500], 50, 100) | |
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
Prawn::Document.generate 'labels.pdf' do | |
data = ["Label 1", "Label 2", "Label 3"] | |
# This will setup the documents margins according to the specified type | |
# then loop through the provided data | |
# | |
labels data, :type => "Avery5160" do |label| | |
text label.data | |
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
HOMEBREW: | |
Resources: http://hughevans.net/2009/11/05/homebrew-ruby-odbc | |
http://gist.github.com/279686 | |
$ brew install unixodbc | |
$ brew install freetds | |
$ brew install ruby-odbc | |
Configure freetds.conf and odbc.ini |
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
text-shadow:0 1px 0 #FFFFFF; |
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 "rubygems" | |
require "builder" | |
class Roster | |
def initialize | |
@members = [] | |
@fresh = true | |
@content = nil | |
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
## Extract Class (http://refactoring.com/catalog/extractClass.html) | |
class Person | |
attr_accessor :name, :office_area_code, :office_number | |
def telephone_number | |
[office_area_code, office_number].join('-') | |
end | |
end |
OlderNewer