Skip to content

Instantly share code, notes, and snippets.

pt-BR:
errors:
messages:
not_found: 'não encontrado'
already_confirmed: 'já foi confirmado'
not_locked: 'não foi bloqueado'
not_saved:
one: '1 erro impediu que %{resource} fosse gravado:'
other: '%{count} erros impediram que %{resource} fosse gravado:'
@phstc
phstc / gist:1989083
Created March 6, 2012 21:34 — forked from willnet/gist:1703102
install manual of swfmill on mac
# http://download.savannah.gnu.org/releases/freetype/ から最新のfreetypeをダウンロード
tar zxvf freetype-x.x.x
cd freetype
./configure
make
sudo make install
curl -O http://www.swfmill.org/releases/swfmill-0.3.2.tar.gz
tar zxvf swfmill-0.3.2.tar.gz
cd swfmill-0.3.2
@phstc
phstc / rails31init.md
Created March 8, 2012 12:52 — forked from samnang/rails31init.md
Rails 3.1 with Rspec, Factory Girl, Haml, Simple Form, Database Cleaner, Spork, and Guard

Install Rails 3.1

gem install rails

generate new app, skipping Test::Unit file generation

rails new my_app -T

Set up Gemfile

@phstc
phstc / friendly_urls.markdown
Created March 24, 2012 22:36 — forked from jcasimir/friendly_urls.markdown
Friendly URLs in Rails

Friendly URLs

By default, Rails applications build URLs based on the primary key -- the id column from the database. Imagine we have a Person model and associated controller. We have a person record for Bob Martin that has id number 6. The URL for his show page would be:

/people/6

But, for aesthetic or SEO purposes, we want Bob's name in the URL. The last segment, the 6 here, is called the "slug". Let's look at a few ways to implement better slugs.

@phstc
phstc / gist:7733092
Created December 1, 2013 12:33 — forked from afeld/gist:5704079

TODO: make gem for this

This was tested using Rails 3.2 and Rails 4.0 on Ruby 2.0.0.

Bower

  1. Set the install directory for Bower components:

// .bowerrc

#!/bin/sh
# Some things taken from here
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Set the colours you can use
black='\033[0;30m'
white='\033[0;37m'
red='\033[0;31m'
green='\033[0;32m'
# lib/liquid_i18n_rails.rb
module LiquidI18nRails
def t(string)
I18n.t(string.to_sym)
end
end
# config/initializers/liquid.rb
require 'liquid_i18n_rails'
Liquid::Template.register_filter LiquidI18nRails
# lib/liquid_i18n_rails.rb
module LiquidI18nRails
def t(string)
I18n.t(string.to_sym)
end
end
# config/initializers/liquid.rb
require 'liquid_i18n_rails'
Liquid::Template.register_filter LiquidI18nRails