I use it. If you don't, read these:
You can still ignore semicolons, but know that ASI is a syntactic error correction procedure,
# 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| |
pt-BR: | |
errors: | |
messages: | |
expired: 'expirou, por favor solicite um novo' | |
not_found: 'não encontrado' | |
already_confirmed: 'já foi confirmado, por favor tente fazer login' | |
not_locked: 'não estava bloqueado' | |
not_saved: | |
one: "1 erro impediu que %{resource} fosse salvo:" | |
other: "%{count} erros impediram que %{resource} fosse salvo:" |
## 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 |
I use it. If you don't, read these:
You can still ignore semicolons, but know that ASI is a syntactic error correction procedure,
#app/controllers/application_controller.rb | |
class ApplicationController < ActionController::Base | |
def opensearch | |
response.headers['Content-Type'] = 'application/opensearchdescription+xml; charset=utf-8' | |
end |
module Mongoid | |
class Criteria | |
def each_by(by, &block) | |
idx = 0 | |
total = 0 | |
set_limit = options[:limit] | |
while ((results = ordered_clone.limit(by).skip(idx)) && results.any?) | |
results.each do |result| | |
return self if set_limit and set_limit >= total |
# config/initializers/char_converter.rb | |
require 'uri' | |
module Support | |
class CharConverter | |
SANITIZE_ENV_KEYS = [ | |
"HTTP_COOKIE", # bad cookie encodings kill rack: https://github.com/rack/rack/issues/225 | |
"HTTP_REFERER", | |
"PATH_INFO", |
require 'fileutils' | |
# Warning: The following deploy task will completely overwrite whatever is currently deployed to Heroku. | |
# The deploy branch is rebased onto master, so the push needs to be forced. | |
desc "Deploy app to Heroku after precompiling assets" | |
task :deploy do | |
deploy_branch = 'heroku' | |
remote = 'heroku' | |
deploy_repo_dir = "tmp/heroku_deploy" |
_bundler_complete() | |
{ | |
if [[ ! `which bundle` ]]; then | |
return | |
fi | |
local cur prev commands | |
commands="help install update package exec config check list show outdated console open viz init gem platform" | |
cur="${COMP_WORDS[COMP_CWORD]}" | |
prev="${COMP_WORDS[COMP_CWORD-1]}" |
### | |
### Rails.root/lib/scheduler.rb | |
### | |
require 'celluloid/autostart' | |
module AwesomeRailsApp | |
class ClockworkScheduler | |
include Celluloid | |
include Clockwork | |
def run |