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
#outer { | |
width: 500px; | |
} | |
#outer:hover #text { | |
-webkit-transition: left linear .5s; | |
position: absolute; | |
left: 100px; | |
} |
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
p { | |
background-color: red; | |
} |
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
# do .. end when we're only interested on the side effect | |
array.each do |item| | |
puts item | |
end | |
# { } when we want the result of the evaluation | |
array.map { |item| | |
item + 1 |
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
irb(main):013:0> blog = Blog.new | |
=> #<Blog id: nil, title: nil, created_at: nil, updated_at: nil> | |
irb(main):014:0> blog.save | |
(0.2ms) BEGIN | |
SQL (0.4ms) INSERT INTO `blogs` (`created_at`, `title`, `updated_at`) VALUES ('2012-04-13 00:56:01', NULL, '2012-04-13 00:56:01') | |
(19.5ms) COMMIT | |
=> true | |
irb(main):015:0> post = blog.posts.new | |
=> #<Post id: nil, blog_id: 2, created_at: nil, updated_at: nil> | |
irb(main):016:0> post.save |
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 Password < ActiveRecord::Base | |
belongs_to :user | |
scope :current, where(:changed_at => nil) | |
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
class Password < ActiveRecord::Base | |
belongs_to :user | |
scope :current, where(:changed_at => nil) | |
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
flores in /Users/flores/Code/sum/sum/mdown-erlang with 1.9.3-p125 on (master *) | |
% erl | |
Erlang R15B (erts-5.9) [source] [64-bit] [smp:2:2] [async-threads:0] [hipe] [kernel-poll:false] | |
Eshell V5.9 (abort with ^G) | |
1> c(markdown). | |
{ok,markdown} | |
2> markdown:to_html(<<"# OK #">>). | |
"<h1>OK</h1>\n" | |
3> markdown:to_html(<<"# OK #\n * OK">>). |
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
case my_var | |
when String then puts "It is a string" | |
when Integer then puts "It is an integer" | |
else puts "It is another thing" | |
end | |
#instead of | |
case my_var.class | |
when String then puts "It is a string" | |
when Integer then puts "It is an integer" |
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 'rubygems' | |
require 'nokogiri' | |
# Nokogiri 1.4.4 | |
object = <<-EOF | |
<object width="425" height="349"><param name="movie" value="http://www.youtube.com/v/dQw4w9WgXcQ?version=3&hl=en_US&rel=0"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/dQw4w9WgXcQ?version=3&hl=en_US&rel=0" type="application/x-shockwave-flash" width="425" height="349" allowscriptaccess="always" allowfullscreen="true"></embed></object> | |
EOF | |
puts Nokogiri::HTML.fragment(object).to_html |
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 'sixarm_ruby_email_address_validation' | |
include EmailAddressValidation | |
email = 'email@invalid' | |
EMAIL_ADDRESS_EXACT_PATTERN =~ email # => 0 |