Skip to content

Instantly share code, notes, and snippets.


Marc Anguera markets

View GitHub Profile
markets / mini_i18n_benchmark.rb
Created Aug 31, 2018
MiniI18n gem benchmarking
View mini_i18n_benchmark.rb
require 'benchmark/ips'
require 'mini_i18n'
require 'i18n'
translations_path = File.expand_path('./spec/fixtures/locales/*')
# Init MiniI18n
# Init I18n
markets / migrate_s3.rake
Created Nov 12, 2015
Migrate Paperclip assets from filesystem to AWS S3
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]
markets / chat_publisher.rb
Last active Dec 19, 2015
Ruby methods to publish content into some chat systems. No API clients or gems required, just curl.
View chat_publisher.rb
# Publish messages to Hipchat
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}" \
# Publish messages to Talker
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}"' \
markets / unicode_irb_rvm
Created Dec 17, 2012
Avoid corrupt unicode input in IRB with rvm and ruby 1.9.3
View unicode_irb_rvm
$ rvm get latest
$ rvm pkg install readline
$ rvm reinstall 1.9.3-p327 --with-readline-dir=$rvm_path/usr