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
| # Style only the first column | |
| pdf.table(leftside, :column_widths => { 0 => 50, 1 =>> 100 }) do |t| | |
| t.column(0).style(:overflow => :shrink_to_fit, :min_font_size => 8) | |
| end | |
| # Custom style for only text cells | |
| pdf.table(leftside, :column_widths => { 0 => 50, 1 =>> 100 }) do |t| | |
| t.cells.grep(Prawn::Table::Cell::Text).each do |c| | |
| c.style(:overflow => :shrink_to_fit, :min_font_size => 8) | |
| 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
| Since Gmail discontinued the "Fixed-width fonts" lab, here's a CSS hack to use a | |
| monospace font for incoming mail: | |
| 1. Install the dotjs extension: | |
| https://addons.mozilla.org/en-US/firefox/addon/dotjs/ | |
| 2. Put this in ~/.css/mail.google.com.css: | |
| /* Read messages in fixed-width font */ |
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
| Prawn::Document.generate "245.pdf" do | |
| w = 60 | |
| bounding_box [0, cursor], :width => w, :height => 200 do | |
| stroke_bounds | |
| text_box "---line one ---line two line three", :width => w, :align => :right | |
| end | |
| 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
| require 'rubygems' | |
| gem 'prawn', '0.11.1' | |
| require 'prawn' | |
| Prawn::Document.generate 'table_test.pdf' do |pdf| | |
| pdf.table [['cell1','cell2'],['cell3','cell4']] do | |
| cells[0, 1].style(:borders => [:bottom, :left]) | |
| cells[1, 1].style(:borders => [:bottom, :right]) | |
| 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
| require 'timecop' | |
| class ApplicationController < ActionController::Base | |
| around_filter :its_sunday_morning | |
| def its_sunday_morning | |
| Timecop.travel(Time.parse("Sun Mar 27 09:01:00 -0400 2011")) { yield } | |
| end | |
| 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
| label_count.times do |i| | |
| pos = i % 20 # pos = label's position on the page (0-19) | |
| pdf.start_new_page if pos == 0 # start new page for the first label on each page | |
| box = pdf.grid(pos/4, pos%4) # lay labels out in 4 columns | |
| # (print label in box) | |
| 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
| Prawn::Document.generate "conditional_formatting.pdf" do |pdf| | |
| data = [["foo", "bar"], | |
| ["", "baz"]] | |
| pdf.table(data) do |t| | |
| t.column(1).style do |c| | |
| if t.cells[c.row, 0].content.empty? | |
| c.text_color = "ff0000" | |
| end | |
| 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
| Prawn::Document.generate "conditional_formatting.pdf" do |pdf| | |
| data = [["foo", "bar"], | |
| ["", "baz"]] | |
| pdf.table(data) do |t| | |
| t.column(1).style do |c| | |
| c.text_color = if t.cells[c.row, 0].content.empty? | |
| "ff0000" | |
| else |
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
| ~ $ avrdude -p m328p -c buspirate -P /dev/tty.usbserial-A6005kOP | |
| Detecting BusPirate... | |
| ** | |
| ** Bus Pirate v3b | |
| ** Firmware v5.10 (r559) Bootloader v4.4 | |
| ** DEVID:0x0447 REVID:0x3043 (24FJ64GA002 B5) | |
| ** http://dangerousprototypes.com | |
| ** | |
| BusPirate: using BINARY mode |
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
| ~/Sites/countryoutfitter.com$ find ~/.rvm/gems/ruby-1.9.2-p136@honest-engine/gems/json-1.4.6/ -name *.bundle -exec otool -L {} \; | |
| /Users/leinj/.rvm/gems/ruby-1.9.2-p136@honest-engine/gems/json-1.4.6//ext/json/ext/generator/generator.bundle: | |
| /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/libruby.1.dylib (compatibility version 1.8.0, current version 1.8.7) | |
| /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.2.1) | |
| /Users/leinj/.rvm/gems/ruby-1.9.2-p136@honest-engine/gems/json-1.4.6//ext/json/ext/json/ext/generator.bundle: | |
| /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/libruby.1.dylib (compatibility version 1.8.0, current version 1.8.7) | |
| /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.2.1) | |
| /Users/leinj/.rvm/gems/ruby-1.9.2-p136@honest-engine/gems/json-1.4.6//ext/json/ext/json/ext/parser.bundle: | |
| /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/libruby.1.dylib (compatibility version 1.8.0, current v |