This file contains hidden or 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
# First | |
class Example | |
def hello | |
puts 'hello' | |
end | |
def vinh | |
puts 'vinh' | |
end | |
end |
This file contains hidden or 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
# is_printed? la 1 cai method, dau hoi la 1 kieu naming convention. Method return true or false se co dau ? | |
# con dau ! la phu dinh | |
while !document.is_printed? | |
document.print_next_page | |
end |
This file contains hidden or 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
@import "compass/css3/filter"; | |
.filtered { | |
@include filter(grayscale(50%)); | |
@include filter(blur(10px)); | |
} |
This file contains hidden or 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
@import "compass/css3"; | |
.main_content { | |
@include flow-into(target); | |
} | |
.regions div { | |
@include flow-from(target); | |
width: 150px; | |
height: 190px; |
This file contains hidden or 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 'oauth' | |
require 'oauth2' | |
class ContactImporter | |
def initialize(importer) | |
@importer = importer | |
end | |
def authorize_url | |
case @importer |
This file contains hidden or 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
for i in 1..100 do | |
if i % 3 == 0 | |
puts 'Anonymous' | |
elsif i % 5 == 0 | |
puts 'Llama' | |
end | |
if (i % 3 == 0 && i % 5 == 0) | |
puts 'AnonymousLlama' | |
end |
This file contains hidden or 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 "switch_user |
This file contains hidden or 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
<% unless @contacts.nil?%> | |
<% @contacts.each do |c|%> | |
<ul> | |
<li><%= c[:name]%> : <%= c[:email]%></li> | |
</ul> | |
<%end%> | |
<%end%> |
This file contains hidden or 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 User < ActiveRecord::Base | |
validate_inclusion_of :activation_state, :in => ["pending", "active"] | |
def self.pending_users | |
find :all, :conditions => {:activation_state => 'pending'} | |
end | |
def self.active_users | |
find :all, :conditions => {:activation_state => 'active'} | |
end |
This file contains hidden or 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 AddNameToUser < ActiveRecord::Migration | |
def self.up | |
add_column :users, :name, :string | |
User.reset_column_information | |
User.find(:all).each do |user| | |
user.name = user.first_name + ' ' + user.last_name | |
end | |
remove_column :users, :first_name | |
remove_column :users, :last_name | |
end |