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
$.fn.serializeObject = function() | |
{ | |
var o = {}; | |
var a = this.serializeArray(); | |
$.each(a, function() { | |
if (o[this.name] !== undefined) { | |
if (!o[this.name].push) { | |
o[this.name] = [o[this.name]]; | |
} | |
o[this.name].push(this.value || ''); |
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
mkdir ~/bin | |
export PATH=~/bin:$PATH | |
ln -s "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl" ~/bin/subl | |
export EDITOR='subl -w' | |
git config --global core.editor "subl -n -w" |
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
desc "Copy paperclip data" | |
task :copy_paperclip_data => :environment do | |
@users = User.find :all | |
@users.each do |user| | |
unless user.image_file_name.blank? | |
filename = Rails.root.join('public', 'system', 'images', user.id.to_s, 'original', user.image_file_name) | |
if File.exists? filename | |
image = File.new filename | |
user.image = image |
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
.file_upload { | |
position: relative; | |
overflow: hidden; | |
float: left; | |
margin-right: 4px; | |
} | |
.file_upload input { | |
position: absolute; | |
top: 0; | |
right: 0; |
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
# Rails3 way to redirect non-www domain to www domain | |
# Single domain redirect | |
'example.com'.tap do |host| | |
constraints(:host => host) do | |
match '/(*path)', :to => redirect { |params, request| Addressable::URI.escape request.url.sub(host, "www.#{host}") } | |
end | |
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
gem 'rack-rewrite' |
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
en: | |
errors: | |
models: | |
model_name: | |
attributes: | |
field_name: | |
reserved: Такое имя пользователя зарезервированно |
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
# -*- encoding: utf-8 -*- | |
# Правило плюрализации для русского языка, взято из CLDR, http://unicode.org/cldr/ | |
# | |
# Russian language pluralization rules, taken from CLDR project, http://unicode.org/cldr/ | |
# | |
# one -> n mod 10 is 1 and n mod 100 is not 11; | |
# few -> n mod 10 in 2..4 and n mod 100 not in 12..14; | |
# many -> n mod 10 is 0 or n mod 10 in 5..9 or n mod 100 in 11..14; | |
# other -> everything else |
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 "i18n/backend/pluralization" | |
I18n::Backend::Simple.send(:include, I18n::Backend::Pluralization) |
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 CategoryConstraint | |
def self.matches?(request) | |
Category.where(alias: request.path_parameters[:categoryalias]).first | |
end | |
end |
OlderNewer