Instantly share code, notes, and snippets.

View mini_i18n_benchmark.rb
require 'benchmark/ips'
require 'mini_i18n'
require 'i18n'
translations_path = File.expand_path('./spec/fixtures/locales/*')
# Init MiniI18n
MiniI18n.load_translations(translations_path)
# Init I18n
View migrate_s3.rake
namespace :attachments do
task migrate_to_s3: :environment do
require 'aws-sdk'
# Define Paperclip models
models = [
[Attachment, :data],
[Image, :data],
[MediaAppearance, :media_logo],
[Testimonial, :avatar_logo]
View chat_publisher.rb
# Publish messages to Hipchat https://www.hipchat.com
def publish_to_hipchat(room_id, msg, from, format, color, auth_token)
`curl -X POST -d "room_id=#{room_id}&message=#{msg}&from=#{from}&message_format=#{format}&color=#{color}" \
"https://api.hipchat.com/v1/rooms/message?auth_token=#{auth_token}"`
end
# Publish messages to Talker http://talkerapp.com
def publish_to_talker(room_id, msg, auth_token)
`curl -H 'Accept: application/json' -H 'Content-Type: application/json' \
-H 'X-Talker-Token: "#{auth_token}"' \
View unicode_irb_rvm
$ rvm get latest
$ rvm pkg install readline
$ rvm reinstall 1.9.3-p327 --with-readline-dir=$rvm_path/usr