Skip to content

Instantly share code, notes, and snippets.

if (-f $document_root/cache$uri) {
rewrite (.*) /cache$1 break;
}
test
def f(ra,n)
r=0
ra.each {|x| r+=1 if x.include? n}
r
end
#!/usr/bin/env ruby
require 'rubygems'
require 'daemons'
workling = File.join(File.dirname(__FILE__), '..', 'vendor', 'plugins', 'workling', 'script', 'listen.rb')
options = {
:app_name => "workling",
:ARGV => ARGV,
:dir_mode => :normal,
:dir => File.join(File.dirname(__FILE__), '..', 'log'),
- if @items
- @items.reject { |item| item[/views\/controls\/(hide-.*|index).haml/] }.each do |name|
%p do some stuff
0 [Time 1250469127] [Message System SafeSleep
hibernate_page_list_setall start
hibernate_page_list_setall time: 171 ms
pages 471790, wire 124924, act 180813, inact 18, spec 6, zf 0, throt 1482, could discard act 44167 inact 27311 purgeable 18574 spec 74495
hibernate_page_list_setall found pageCount 307243
IOHibernatePollerOpen, ml_get_interrupts_enabled 0
IOHibernatePollerOpen(0)
writing 306047 pages
image1Size 166038016
all time: 11786 ms, comp time: 1871 ms, deco time: 0 ms,
>> yaml = StandardError.new("foo").to_yaml
=> "--- !ruby/exception:StandardError \nmessage: foo\n"
>> error = YAML.load(yaml)
=> #<StandardError: StandardError>
>> error.message
=> "StandardError"
>> error.to_yaml
=> "--- !ruby/exception:StandardError \nmessage: StandardError\nmesg: foo\n"
rabbit_stew do |stew|
stew.fanout :bar, :queue => 'foo'
stew.direct :baz, :queue => 'wee'
stew.topic :wah do |topic|
topic.key "faz.*", :queue => 'wee'
end
queue :foo do
puts "im the foo queue. I handle the bar fanout for now."
end
class NilClass
def id
rand(999999999)
end
end
gem = gem_package "gem" do
action :nothing
end
gem.run_action(:install)
Gem.clear_paths
require 'gem'
# shorthand