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 crisalix-emoji.js
plugin.onMessageInsertion = function (event) {
var content;
content = Talker.getLastInsertion().replace(/:[\w_+]+:/g, function (match) {
var emoji = match,
filename = (emoji == ':+1:' ? ':plus1:' : emoji).replace(/:/g, '');
return "<img class=\"emoji\" title=\"" + emoji + "\" alt=\"" + emoji + "\" height=\"20\" width=\"20\" align=\"absmiddle\" src=\"https://teambox.com/assets/emojis/" + filename + ".png\">"
});
return content;
};
View unicode_irb_rvm
$ rvm get latest
$ rvm pkg install readline
$ rvm reinstall 1.9.3-p327 --with-readline-dir=$rvm_path/usr