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
# First configure your models to use Amazon s3 as storage option and setup the associated S3 config. | |
# Then add the classes your want to migrate in the klasses array below. | |
# Then run rake paperclip_migration:migrate_to_s3 | |
# Should work but this is untested and may need some tweaking - but it did the job for me. | |
namespace :paperclip_migration do | |
desc "migrate files from filesystem to s3" | |
task :migrate_to_s3 => :environment do | |
klasses = [:model_1, :model_2] # Replace with your real model names. If anyone wants to this could be picked up from args or from configuration. | |
klasses.each do |klass_key| |
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
#!/bin/bash | |
# Assuming that Diaspora is deployed to $HOME/diaspora/master | |
HOME_FOLDER="/home/diaspora" | |
cd $HOME_FOLDER/diaspora/master | |
source "${HOME_FOLDER}/.rvm/environments/ruby-1.9.3-p0@diaspora" | |
rvm use "ruby-1.9.3-p0@diaspora" | |
# RUBY GC HEAP |
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
# app/models/post.rb | |
class Post | |
searchable :auto_index => false, :auto_remove => false do | |
text :title | |
text :body | |
end | |
after_commit :resque_solr_update |
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
#app/controllers/application_controller.rb | |
class ApplicationController < ActionController::Base | |
def opensearch | |
response.headers['Content-Type'] = 'application/opensearchdescription+xml; charset=utf-8' | |
end |
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
# It extends activeadmin to show pretty boolean values | |
# | |
# config/initializers/active_admin.rb | |
module ActiveAdmin | |
module Views | |
class TableFor | |
def bool_column(attribute) | |
column(attribute){ |model| model[attribute] ? '✔'.html_safe : '✗'.html_safe } | |
end |
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
## mysql::master | |
ruby_block "store_mysql_master_status" do | |
block do | |
node.set[:mysql][:master] = true | |
m = Mysql.new("localhost", "root", node[:mysql][:server_root_password]) | |
m.query("show master status") do |row| | |
row.each_hash do |h| | |
node.set[:mysql][:master_file] = h['File'] | |
node.set[:mysql][:master_position] = h['Position'] | |
end |
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
### | |
### Rails.root/lib/scheduler.rb | |
### | |
require 'celluloid/autostart' | |
module AwesomeRailsApp | |
class ClockworkScheduler | |
include Celluloid | |
include Clockwork | |
def run |
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
[ubuntu@solr jruby-1.7.4 (master)] ~/rails $ bundle install -j8 | |
Updating git://github.com/FernandoEscher/sql_funk.git | |
Fetching from: http://rubygems.org/api/v1/dependencies | |
HTTP Success | |
Fetching source index from http://rubygems.org/ | |
Resolving dependencies.......................................................Fetching from: http://rubygems.org/quick/Marshal.4.8/pg-0.15.1-x86-mingw32.gemspec.rz | |
HTTP Redirection | |
Fetching from: http://production.cf.rubygems.org/quick/Marshal.4.8/pg-0.15.1-x86-mingw32.gemspec.rz | |
HTTP Success | |
........................................................................................................................................................................................................Fetching from: http://rubygems.org/quick/Marshal.4.8/foreman-0.63.0-mingw32.gemspec.rz |
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
[color] | |
branch = auto | |
diff = auto | |
status = auto | |
interactive = auto | |
ui = auto | |
[color "branch"] | |
current = yellow reverse | |
local = yellow |
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
require 'celluloid' | |
class IronQueueWorker | |
include Celluloid | |
def initialize | |
@token = "your-token" | |
@old_project_id = "source-project-id" | |
@new_project_id = "source-project-id" | |
@old_iron_cache = IronCache::Client.new(token: @token, project_id: @old_project_id) | |
@new_iron_cache = IronCache::Client.new(token: @token, project_id: @new_project_id) |
OlderNewer