Skip to content

Instantly share code, notes, and snippets.

@mediasota
mediasota / Gemfile
Created November 27, 2013 23:55 — forked from pcreux/Gemfile
heroku add-ons and configuration to speed
group :production do
gem 'unicorn'
# Enable gzip compression on heroku, but don't compress images.
gem 'heroku-deflater'
# Heroku injects it if it's not in there already
gem 'rails_12factor'
end
@mediasota
mediasota / Gemfile
Created September 16, 2013 07:07 — forked from majioa/Gemfile
gem 'koala'
gem 'bitly', '~> 0.8.0'
gem 'twitter'
source 'https://rubygems.org'
gem 'activerecord', '4.0.0.rc1'
#!/bin/sh
#
backupdir="./pg_backups"
pgdump_args="-bF c"
pgdumpall_globals_args=""
pg_backup() {
if [ ! -d ${backupdir} ]; then
echo Creating $backupdir
# Rails 4 Application Template
# Remove normal files we don't want
remove_file "README.rdoc"
remove_file "public/index.html"
remove_file "app/assets/images/rails.png"
# Copy database.yml to sample
inside "config" do
run "cp database.yml database.yml.sample"
end
# app/controllers/custom_devise/password_controller.rb
class CustomDevise::PasswordsController < Devise::PasswordsController
def resource_params
params.require(resource_name).permit(:email, :password, :password_confirmation)
end
private :resource_params
end
upstream backend {
server 127.0.0.1:3000 fail_timeout=0;
}
server {
listen 80;
server_name mydomain.com;
root /path/to/project/public;

Note that this validation runs both after the file is uploaded and after CarrierWave has processed the image. If your base uploader includes a filter to resize the image then the validation will be run against the resized image, not the original one that was uploaded. If this causes a problem for you, then you should avoid using a resizing filter on the base uploader and put any specific size requirements in a version instead.

So instead of this:

require 'carrierwave/processing/mini_magick'

ru:
activerecord:
errors:
messages:
taken: "%{model} с таким именем уже существует"
record_invalid: "Валидация не прошла: %{errors}"
restrict_dependent_destroy:
one: "Невозможно удалить запись, так как существуют зависимости: %{record}"
many: "Невозможно удалить записи, так как существуют зависимости: %{record} "
inclusion: "недопустимое значение"
@mediasota
mediasota / README.md
Created October 25, 2012 05:05 — forked from briangonzalez/README.md
img2boxshadow - a ruby script to convert images to CSS [http://codepen.io/briangonzalez/details/AvrGI#pen-details-tab]

img2boxshadow.rb

a ruby script to convert images to CSS (box-shadows)

Installation

gem install rmagick    # you'll need ImageMagick & Ruby first
gem install colormath
gem install micro-optparse