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
| run ->(e){ p=Hash[*e['QUERY_STRING'].split(/[&=]/)]; [200, {'Content-type'=>'text/html'}, ["Hello #{p['name']}!"]] } |
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
| sudo passenger-install-apache2-module | |
| Welcome to the Phusion Passenger Apache 2 module installer, v3.0.9. | |
| This installer will guide you through the entire installation process. It | |
| shouldn't take more than 3 minutes in total. | |
| Here's what you can expect from the installation process: | |
| 1. The Apache 2 module will be installed for you. | |
| 2. You'll learn how to configure Apache. |
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
| function new-git () { | |
| ssh [email protected] "mkdir $1.git && cd $1.git && git --bare init" | |
| git remote add origin [email protected]:$1.git | |
| git push origin master | |
| git config branch.master.remote origin | |
| git config branch.master.merge refs/heads/master | |
| git config push.default current | |
| } |
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
| 1313 | Streptococcus pneumoniae | | scientific name | | |
| 1313 | Streptococcus pneumoniae (Klein 1884) Chester 1901 | | authority | | |
| 10728 | Streptococcus pneumoniae bacteriophage HB-3 | | synonym | | |
| 10728 | Streptococcus pneumoniae phage HB-3 | | scientific name | | |
| 12402 | phage EJ-1 #note host Streptococcus pneumoniae | | misspelling | | |
| 120574 | Streptococcus pneumoniae bacteriophage MM1 | | synonym | | |
| 170187 | Streptococcus pneumoniae TIGR4 | | scientific name | | |
| 171101 | Streptococcus pneumoniae (strain ATCC BAA-255 / R6) | | synonym | | |
| 171101 | Streptococcus pneumoniae R6 | | scientific name | | |
| 171101 | Streptococcus pneumoniae str. R6 | | synonym | |
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
| <MedlineCitation Owner="NLM" Status="MEDLINE"> | |
| <PMID Version="1">19663746</PMID> | |
| <DateCreated> | |
| <Year>2009</Year> | |
| <Month>08</Month> | |
| <Day>11</Day> | |
| </DateCreated> | |
| <DateCompleted> | |
| <Year>2010</Year> | |
| <Month>03</Month> |
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 ApplicationHelper | |
| def inside_layout(layout = 'application', &block) | |
| render :inline => capture_haml(&block), :layout => "layouts/#{layout}" | |
| 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
| def reify_has_manys(model, lookback) | |
| model.class.reflect_on_all_associations(:has_many).each do |assoc| | |
| # Get live children. | |
| children = model.send assoc.name | |
| # Ensure child models are using PaperTrail. | |
| if children.first.respond_to? :version_at | |
| # Handle updated children, and children created since the parent's version. | |
| children_then = [] | |
| children.each do |child| | |
| if (child_as_it_was = child.version_at(created_at - lookback.seconds)) |
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 PublicationsController < ActionController::Base | |
| def show | |
| @publication = Publication.find params[:id] | |
| # If you need a specific version, get that from the URL. | |
| version_id = ... | |
| @publication = @publication.versions.find version_id | |
| keywords = [] # the keywords belonging to @publication at the time | |
| keywords_versions = Version.all :item_type => 'Keyword', :publication_id => @publication.id |
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
| keywords = [] # the keywords belonging to @publication at the time | |
| keywords_versions = Version.all :item_type => 'Keyword', :publication_id => @publication.id | |
| keywords_versions.group_by(&:item_id).each do |item_id, versions| | |
| v = versions.first :conditions => ['created_at > ?', (@publication.created_at - 3.seconds)] | |
| keywords << (v ? v.reify : Keyword.find(item_id)) | |
| end | |
| variables = keywords.map do |keyword| |
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
| $ rake test | |
| (in /Users/andy/business/open_source/paper_trail) | |
| /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby -I"lib:lib:test" "/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake/rake_test_loader.rb" "test/paper_trail_controller_test.rb" "test/paper_trail_model_test.rb" "test/paper_trail_schema_test.rb" "test/thread_safe_test.rb" | |
| /Library/Ruby/Site/1.8/rubygems.rb:233:in `activate': can't activate actionpack (= 2.3.8, runtime) for [], already activated actionpack-3.0.0 for [] (Gem::LoadError) | |
| from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:35:in `require' | |
| from ./test/test_helper.rb:8 | |
| from ./test/paper_trail_controller_test.rb:1:in `require' | |
| from ./test/paper_trail_controller_test.rb:1 | |
| from /Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake/rake_test_loader.rb:5:in `load' | |
| from /Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake/rake_test_loader.rb:5 |