Skip to content

Instantly share code, notes, and snippets.

irb(main):073:0> $redis.lrange "1069", 0, 1000
=> ["2275153", "2275153", "2275153"]
irb(main):074:0> $redis.del "1069"
=> false
irb(main):075:0> $redis.lrange "1069", 0, 1000
=> 0
irb(main):076:0> $redis.lrange "1068", 0, 1000
=> []
irb(main):077:0> $redis.lrange "1069", 0, 1000
=> []
>> @unit1.updated_at.to_s
=> "2009-09-25T15:44:55-07:00"
>> @unit1.updated_at = 3.days.ago
=> Tue Sep 22 15:45:14 -0700 2009
>> @unit1.updated_at.to_s
=> "2009-09-22T15:45:14-07:00"
>> @unit1.save
=> true
>> @unit1.updated_at.to_s
=> "2009-09-25T15:45:27-07:00"
@bpo
bpo / gist:183456
Created September 9, 2009 03:39 — forked from mtodd/gist:180398
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
Quotes also give you more freedom/creativity with the terminal ID:
#!/usr/bin/env ruby
require 'rubygems'
require 'thor'
require 'chef'
require 'chef/node'
require 'chef/rest'
# Please see the readme for overview documentation.
#
# chef solo failure.
# notes:
# - this machine does not have a 'domain' assigned by ohai (hostname -f has no dots in it)
# - ubuntu 9.04, fresh installation
# sudo chef-solo -c ~/solo.rb -j ~/bootstrap.json -r http://s3.amazonaws.com/chef-solo/bootstrap-latest.tar.gz
[Wed, 19 Aug 2009 23:05:17 +0000] INFO: Starting Chef Solo Run
/usr/lib/ruby/gems/1.8/gems/chef-0.7.8/lib/chef/node/attribute.rb:372:in `method_missing': Attribute domain is not defined! (ArgumentError)
from /usr/lib/ruby/gems/1.8/gems/chef-0.7.8/lib/chef/node.rb:236:in `send'
from /usr/lib/ruby/gems/1.8/gems/chef-0.7.8/lib/chef/node.rb:236:in `method_missing'
(rdb:1) pp csv.parts.all(:completed => false)
[#<CSVPart
full = true,
content_length = 0,
updated_at = #<DateTime: 35351787367/14400,-7/24,2299161>,
index = 0,
created_at = #<DateTime: 35351787367/14400,-7/24,2299161>,
completed = false,
csv_meta_id = 5,
id = 6>]