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 'sidekiq' | |
class LazyWorker | |
include Sidekiq::Worker | |
def perform | |
# nothing | |
end | |
end | |
Sidekiq.configure_client do |config| |
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
640 ::CLASS | |
645 /Users/mikep/.rubies/ruby-2.1.1/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:ARRAY | |
676 /Users/mikep/.rubies/ruby-2.1.1/lib/ruby/2.1.0/rubygems/stub_specification.rb:21:STRING | |
722 /Users/mikep/.rubies/ruby-2.1.1/lib/ruby/2.1.0/x86_64-darwin13.0/openssl.bundle:0:STRING | |
724 /Users/mikep/.rubies/ruby-2.1.1/lib/ruby/2.1.0/rubygems/specification.rb:1338:OBJECT | |
734 /Users/mikep/.rubies/ruby-2.1.1/lib/ruby/2.1.0/rubygems/requirement.rb:92:ARRAY | |
734 /Users/mikep/.rubies/ruby-2.1.1/lib/ruby/2.1.0/rubygems/requirement.rb:92:STRING | |
872 /Users/mikep/.rubies/ruby-2.1.1/lib/ruby/2.1.0/rubygems/requirement.rb:53:OBJECT | |
876 /Users/mikep/.gem/ruby/2.1.1/gems/sprockets-2.10.0/lib/sprockets/mime.rb:1:STRING | |
884 /Users/mikep/.gem/ruby/2.1.1/gems/mime-types-1.25/lib/mime/types.rb:423:STRING |
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 'bigdecimal' | |
=> true | |
> Float('foo') | |
ArgumentError: invalid value for Float(): "foo" | |
from (irb):2:in `Float' | |
from (irb):2 | |
from /Users/mikep/.rubies/ruby-2.0.0-p353/bin/irb:12:in `<main>' | |
> Integer('foo') | |
ArgumentError: invalid value for Integer(): "foo" | |
from (irb):3:in `Integer' |
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
class MoveInventoryUpdatesToS3 < ActiveRecord::Migration | |
def up | |
batch = Sidekiq::Batch.new | |
batch.jobs do | |
InventoryUpdate.where("content is not null").pluck(:id).each do |iuid| | |
InventoryUpdate.delay.send_to_s3(iuid) | |
end | |
end | |
# wait for all jobs to finish |
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
# Use open to ensure tempfile is cleaned up asap | |
Tempfile.open("somename") do |tfile| | |
# Stage 1 - create the tempfile with some data | |
tfile.write "some bytes" | |
tfile.close | |
# Stage 2 - use the tempfile | |
File.open(tfile.path) do |file| | |
assert "some bytes", file.read |
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
class ActiveRecord::Base | |
class << self | |
def inherited_yolo(klass) | |
old_inherited(klass) | |
klass.attr_accessible(*klass.column_names.map(&:to_sym)) unless klass.abstract_class? | |
end | |
alias_method :old_inherited, :inherited | |
alias_method :inherited, :inherited_yolo | |
end | |
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
--- a/site-cookbooks/monit/templates/default/memcached.conf.erb | |
+++ b/site-cookbooks/monit/templates/default/memcached.conf.erb | |
@@ -2,5 +2,5 @@ check process memcached | |
with pidfile /var/run/memcached.pid | |
start program = "/etc/init.d/memcached start" | |
stop program = "/etc/init.d/memcached stop" | |
- if failed port 11211 protocol memcache 4 times within 6 cycles then restart | |
+ if failed port 11211 4 times within 6 cycles then restart | |
if 5 restarts within 5 cycles then timeout |
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
1 (M=55122) ~/src/theclymb> rvm info | |
ruby-1.9.3-p125@theclymb3: | |
system: | |
uname: "Darwin Mikes-MacBook-Air.local 12.2.0 Darwin Kernel Version 12.2.0: Sat Aug 25 00:48:52 PDT 2012; root:xnu-2050.18.24~1/RELEASE_X86_64 x86_64" | |
system: "osx/10.8/x86_64" | |
bash: "/bin/bash => GNU bash, version 3.2.48(1)-release (x86_64-apple-darwin12)" | |
zsh: "/bin/zsh => zsh 4.3.11 (i386-apple-darwin12.0)" |
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
.FF.......................................................................................................................................................................................................... | |
--------------------------------------------- | |
CRASH: A fatal error has occurred. | |
Backtrace: | |
0 rbx 0x000000010c04f6d0 _ZN8rubiniusL12segv_handlerEi + 544 | |
1 libsystem_c.dylib 0x00007fff91c31cfa _sigtramp + 26 | |
2 libsystem_c.dylib 0x00007fff91c2f3c8 malloc_zone_malloc + 77 | |
3 rbx 0x000000010c16a202 _ZN8rubinius12CompiledCode4Info4markEPNS_6ObjectERNS_10ObjectMarkE + 318 | |
4 rbx 0x000000010c20075e _ZN8rubinius16GarbageCollector11scan_objectEPNS_6ObjectE + 456 |
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
(speedup_rails_startup=fa456 .rvmrc bin/) ~/src/clymb> !time | |
time bundle exec rake environment | |
real 0m7.853s | |
user 0m6.485s | |
sys 0m1.129s | |
(speedup_rails_startup=fa456 .rvmrc bin/) ~/src/clymb> time bundle exec rake environment | |
real 0m7.478s | |
user 0m6.378s |