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
#!/usr/bin/env ruby | |
#/ Usage: <progname> [options]... | |
#/ How does this script make my life easier? | |
# ** Tip: use #/ lines to define the --help usage message. | |
$stderr.sync = true | |
require 'optparse' | |
# default options | |
flag = false | |
option = "default value" |
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
module Where | |
class <<self | |
attr_accessor :editor | |
def is_proc(proc) | |
source_location(proc) | |
end | |
def is_method(klass, method_name) | |
source_location(klass.method(method_name)) |
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 this behind the scenes to migrate files from your filesystem to Amazon S3 | |
# %: rake paperclip_migration:migrate_to_s3 | |
## | |
namespace :attachments do | |
desc "migrate files from filesystem to s3" | |
task :migrate_to_s3 => :environment do | |
require 'aws/s3' |
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
# Minimal example that demonstrates a memory leak in Celluloid. | |
# Adapted from @debrasetton example: https://github.com/mperham/sidekiq/issues/2107 | |
# Adapted from @grosser example: https://github.com/mperham/sidekiq/blob/master/examples/leak.rb | |
# Run with LEAK=0 for no memory leak or LEAK=1 for memory leak, like so: | |
# LEAK=1 ruby ./leak.rb > /dev/null | |
require 'celluloid/autostart' | |
Celluloid.logger = nil | |
$counter = 0 | |
$jobs = 5_000 |