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
| ~ (ree-1.8.7) » python --version ~ | |
| Python 2.7.1 |
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
| # using rvm with ruby-1.8.7-p249 | |
| # latest version 2.7.7 2010-06-17 | |
| brew install libxml2 | |
| # installing libxslt from source code | |
| wget ftp://xmlsoft.org/libxml2/libxslt-1.1.26.tar.gz | |
| ./configure --prefix=/usr/local/Cellar/libxslt/1.1.26 --with-libxml-prefix=/usr/local/Cellar/libxml2/2.7.7 | |
| make | |
| sudo make install |
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 'sixarm_ruby_email_address_validation' | |
| include EmailAddressValidation | |
| email = 'email@invalid' | |
| EMAIL_ADDRESS_EXACT_PATTERN =~ email # => 0 |
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 '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 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
| 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 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
| pt-BR: | |
| simple_form: | |
| "yes": 'Sim' | |
| "no": 'Não' | |
| required: | |
| text: 'obrigatório' | |
| mark: '*' | |
| # You can uncomment the line below if you need to overwrite the whole required html. | |
| # When using html, text and mark won't be used. | |
| # html: '<abbr title="required">*</abbr>' |
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
| 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 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 Password < ActiveRecord::Base | |
| belongs_to :user | |
| scope :current, where(:changed_at => nil) | |
| 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 Password < ActiveRecord::Base | |
| belongs_to :user | |
| scope :current, where(:changed_at => nil) | |
| 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
| 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 |