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
| =begin | |
| Appatra is a new and simple framework for building surprisingly agnostic | |
| desktop (and maybe even mobile) applications in Ruby. | |
| It'll even try to generate a native application for your target platform | |
| too because I know how much people really like that. | |
| Appatra is by Ryan Stenhouse. If you want to know more about it or get | |
| involved, please email ryan@stenhou.se |
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
| class Configuration | |
| attr_accessor :tail_logs, :max_connections, :admin_password, :app_server | |
| class AppServer | |
| attr_accessor :port, :admin_password | |
| end | |
| def initialize | |
| @app_server = AppServer.new | |
| 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
| # GemAgent API Interface | |
| # Ryan Stenhouse, 20 January 2011 | |
| # Longhand representation of connecting to the FreeAgent API | |
| # | |
| ga = GemAgent::NetHttpConnection.new 'you.freeagentcentral.com', GemAgent::HttpBasicAuthentication.new('username','password') | |
| ga.verify # => { :user_id => 1, :permission_level => 8, :company_type => UK_LIMITED } | |
| # Sexy sugary version of the above. | |
| # |
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' | |
| require 'prawn/graph' | |
| require 'prawn/background_document' | |
| require 'active_record' | |
| Prawn::BackgroundDocument.generate('some_file.pdf', :callback => [ :completed, :failure ]) do |pdf| | |
| pdf.bar_graph Bees.where('number_spotted > 0').order('number_spotted'), :best_fit | |
| end | |
| def completed |
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
| # Replace the YAML'd hash in config/database.yml with an actual Ruby hash. | |
| # | |
| { | |
| :development => { :name => 'dev', :adapter => 'mysql', :username => 'root', :password => '' }, | |
| :test => { :name => 'test', :adapter => 'mysql', :username => 'root', :password => '' }, | |
| :production => { :name => 'prod' :adapter => 'mysql', :username => 'db', :password => '1234', :host => 'db1.app.com' } | |
| } |
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' | |
| require 'prawn' | |
| pdf = Prawn::Document.new(:page_size => "A4", :page_layout => :landscape) | |
| pdf.bounding_box [0, pdf.bounds.height - 40,], :width => 740 do | |
| # No Entries | |
| # | |
| pdf.table([["Total Value of Spend", "Total Transactions", "Average Transaction Value"], ["4558.5100", "30", "151.95033333"]], :header => true) do | |
| row(0).style(:style => :bold, :background_color => 'cccccc') | |
| 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
| set :trigger_sign, '!' | |
| on :privmsg, :in => :channel, :trigger => 'stuff' do |channel, user, message| | |
| channel.message StuffMachine.random_entry | |
| end | |
| on :privmsg, :in => :channel, :trigger => 'findstuff' do |channel, user, message| | |
| user.notice StuffMachine.find(message) | |
| 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 "#{File.dirname(__FILE__)}/../example_helper.rb" | |
| options = { | |
| :title => 'Average litter size per kind of animal', | |
| :label_x => 'Kind of animal', | |
| :label_y => 'Average litter size', | |
| :theme => Prawn::Chart::Themes.monochrome , | |
| :at => [10,10] | |
| } |
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('bar_graph.pdf') do | |
| bar_graph 'Hornets on Weekdays', [ 10, 10 ], :keynote do |graph| | |
| graph.data 'Monday', 5 | |
| graph.data 'Tuesday', 4 | |
| graph.data 'Wednesday', 3 | |
| graph.data 'Thursday', 2 | |
| graph.data 'Friday', 1 | |
| graph.label_x 'Week Day' | |
| graph.label_y 'Number of Hornets' | |
| 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
| name: keynote | |
| title: Keynote Theme | |
| font_color: 'FFFFFF' | |
| background_colour: '000000' | |
| marker_colour: 'FFFFFF' | |
| stroke_grid_markers: 0 | |
| colours: | |
| - '6886B4' | |
| - 'FDD84E' | |
| - '72AE6E' |