reference:
Part1: astockwell.com
Part2: astockwell.com
reference:
Part1: astockwell.com
Part2: astockwell.com
# rails methods | |
# returns column_names arrays | |
Model.column_names | |
# returns attr_keys arrays | |
object.attributes.keys | |
# returns attr_keys values | |
object.attributes.values |
# rails migration | |
######################## | |
# add column to exsting table | |
######################## | |
def up | |
add_column :users, :status, :string | |
User.find_each do |user| | |
user.status = 'active' |
# ref: http://www.jimmycuadra.com/posts/metaprogramming-ruby-class-eval-and-instance-eval) | |
class Person | |
end | |
Person.class_eval do | |
def say_hello | |
"Hello!" | |
end | |
end |
########################################################## | |
# polymorphic as module | |
########################################################## | |
# app/models/comment.rb | |
# | |
class Comment < ActiveRecord::Base | |
belongs_to :commenter, :polymorphic => true | |
end |
// CSS dictionary | |
// <a href="#" rel="friend nofollow">Larry</a> | |
li a[rel~='friend'] { | |
font-weight: bold; | |
} | |
// target only #upperSection, #lowerSection | |
// <div id="upperSection"> | |
// <p>Lorem ipsum dolor sit amet...</p> |
# 나는 이녀석을 참고했다. | |
# http://linfiniti.com/2012/05/installing-postgis-2-0-on-ubuntu/ | |
# | |
# 환경변수에 LC_COLLATE=C 이거 있는지 확인 | |
#1. Install PostgreSQL postgis and postgres | |
sudo dpkg --purge postgis postgresql-9.1-postgis | |
sudo apt-get install python-software-properties |