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
string =<<-EOX | |
<?xml version="1.0" encoding="utf-8" ?><Response xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xml.truveo.com" | |
xsi:schemaLocation="http://xml.truveo.com/apiv3.xsd"><method>truveo.videos.getVideos</method><query>iphone</query><queryCategory>default</queryCategory> | |
<partialMatch>0</partialMatch><VideoSet><totalResultsAvailable>218367</totalResultsAvailable><totalResultsReturned>10</totalResultsReturned><firstResultPosition>0</firstResultPosition> | |
<title>Iphone Videos</title><rssUrl>http://xml.truveo.com/rss?query=iphone&showAdult=0&a=8466e666a2b70e9599b8d92d6c238d70</rssUrl><embedTag><embed src="http://www.truveo.com/truveo_listWidget.swf?query=iphone&resultsnum=10" quality="high" wmode="transparent" type="application/x-shockwave-flash" width="600" height="150"></embed></embedTag><Video><id>1600467146</id><title>'Top Gun' for the iPhone</title><sponsored>0</sponsored><videoUrl>http |
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
This happens when I log into my chef server (CentOS RPM install). I suspect CouchDB was not initialized correctly (because it was already running) when I installed chef. | |
~ Params: {"action"=>"index", "controller"=>"chef_server_slice/nodes"} | |
~ 500 "Internal Server Error" - (Net::HTTPFatalError) | |
/usr/lib/ruby/1.8/net/http.rb:2097:in `error!' | |
/usr/lib/ruby/gems/1.8/gems/chef-0.7.4/lib/chef/rest.rb:232:in `run_request' | |
/usr/lib/ruby/gems/1.8/gems/chef-0.7.4/lib/chef/rest.rb:85:in `get_rest' | |
/usr/lib/ruby/gems/1.8/gems/chef-0.7.4/lib/chef/couchdb.rb:124:in `list' | |
/usr/lib/ruby/gems/1.8/gems/chef-0.7.4/lib/chef/node.rb:351:in `list' |
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
name "ruby_app_server" | |
recipes "capistrano", "rubyee", "rails", "memcached" | |
override_attributes "memcached" => { "memory" => 2048 } | |
override_attributes "rails" => { "version" => '2.1.2' } |
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
task :gems_install do | |
GEMS = [] | |
module Rails | |
class Config | |
def gem(name, options = {}) | |
GEMS << Rails::GemDependency.new(name, options) | |
end | |
def method_missing(*args) | |
# ignore | |
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
require "merb-mailer/mailer" | |
require 'socket' | |
Merb::Mailer.delivery_method = :sendmail | |
class ErrorMailer | |
def self.template(name, error, context) | |
data = <<-EOF | |
I regret to inform you that your daemon, #{name}, caught an error at #{Time.now} while running on #{Socket.gethostname}. |
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
goblin:~/.ruby_versions/jruby-1.3.1/bin$ export JRUBY_OPTS= | |
goblin:~/.ruby_versions/jruby-1.3.1/bin$ ./jruby --ng -v | |
jruby 1.3.1 (ruby 1.8.6p287) (2009-06-15 2fd6c3d) (Java HotSpot(TM) 64-Bit Server VM 1.6.0_13) [x86_64-java] | |
goblin:~/.ruby_versions/jruby-1.3.1/bin$ export JRUBY_OPTS="--ng" | |
goblin:~/.ruby_versions/jruby-1.3.1/bin$ ./jruby --ng -v | |
jruby: unknown option --ng | |
goblin:~/.ruby_versions/jruby-1.3.1/bin$ ./jruby -v | |
jruby: unknown option --ng |
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
Using ruby 1.8.7 (2008-08-11 patchlevel 72) [universal-darwin10.0] | |
goblin:~$ sudo gem install memcached | |
Password: | |
Building native extensions. This could take a while... | |
Successfully installed memcached-0.16 | |
1 gem installed | |
goblin:~$ ruby -e 'system("ruby #{File.dirname(`gem which memcached`.split("\n"). | |
> last)}/../test/profile/benchmark.rb")' | |
Loading memcached | |
Loading memcache |
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
Surround a heredoc with quotes and you can continue the code on the same line: | |
render :status => 404, :text => <<-'EOH' and return unless setup | |
article not found<br/> | |
I, as a server, have failed<br/> | |
https? | |
EOH |
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
Nokogiri::XML::Builder.new(:encoding => 'UTF-8') do |xml| | |
osa = xml.add_namespace_declaration('osa', "http://www.onespot.com/Atom/Extensions/1.0") | |
xml.feed :xmlns=>'http://www.w3.org/2005/Atom' do | |
xml.div :xmlns=>'http://www.w3.org/1999/xhtml', :class=>'info' do | |
xml.text "This is an Atom formatted XML site feed. It is intended to be viewed in a Newsreader or syndicated to another site." | |
end | |
xml.title 'feed title', :type=>"html" | |
xml.entry do |
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 'nokogiri' | |
xml = Nokogiri::XML::Builder.new(:encoding => 'UTF-8') do |xml| | |
xml.feed( | |
:xmlns => 'http://www.w3.org/2005/Atom', | |
'xmlns:osa' => 'http://www.onespot.com/Atom/Extensions/1.0' | |
) do | |
xml.title 'feed title', :type => "html" |