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 | |
set -e | |
show_help() { | |
cat << EOF | |
Usage: ${0##*/} [-u USER] [-p PASS] [-P PORT] [-H HOST] [DATABASE] | |
${0##*/} -h | |
Open a standard connection in Sequel PRO. |
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
pt-BR: | |
errors: | |
messages: | |
expired: "expirou, por favor solicite uma nova" | |
not_found: "não encontrado" | |
already_confirmed: "já foi confirmado, por favor tente fazer login" | |
not_locked: "não foi bloqueado" | |
not_saved: | |
one: "1 erro evitou que este %{resource} fosse gravado:" | |
other: "%{count} erros evitaram que este %{resource} fosse gravado:" |
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
class MigrateProductsToPaperclip < ActiveRecord::Migration | |
def self.up | |
# Rename the old "image" column to "old_file_name", since Product.image will now try to do Paperclip stuff | |
rename_column :products, :image, :old_file_name | |
# Rename asset directories to pluralize | |
File.rename("public/system/product","public/system/products") | |
File.rename("public/system/products/image","public/system/products/images") | |
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
DIRECTORIES = %w(Users/username) | |
TO = '/path/for/backup' | |
OPTIONS = { :rsync => '--progress -varRu', :remote => false } | |
rsync DIRECTORIES, nil, TO, OPTIONS |
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 'rubygems' | |
require 'activesupport' | |
def rsync(directories, from, to, options = {}) | |
options.reverse_merge!(:rsync => "-varRu", | |
:remote => true) | |
directories.each do |dir| | |
destination = options[:remote] ? "#{from}:/#{dir}" : "/#{dir}" | |
command = "rsync #{options[:rsync]} #{destination} #{to}" |
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
# | |
# Generates the migration and opens it in TextMate | |
# | |
# ex.: | |
# mig AddNewColumnToModel new_column:integer | |
# | |
function mig { | |
mate `script/generate migration $@ | tail -n1 | sed 's/.*create //'` | |
} |
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
class ImageModelsController < ApplicationController | |
before_filter :find_image_model, :only => [:update] | |
def update | |
if @image_model.update_attributes(params[:image_model]) | |
@image_model.image.reprocess! | |
end | |
end | |
protected |