Skip to content

Instantly share code, notes, and snippets.

🚀
ActiveShipping

Marc Anguera Insa markets

Block or report user

Report or block markets

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@markets
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
MiniI18n.load_translations(translations_path)
# Init I18n
@markets
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
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 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}"' \
@markets
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
You can’t perform that action at this time.