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
# encoding: cp866 | |
money = 100 | |
puts "\nЯ вижу у тебя есть #{money}$ и тебе не терпится их проиграть? Ну что же, начнём!" | |
1000.times do | |
puts |
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 "nokogiri" | |
# 1) What is your favorite Ruby class/library or method and why? | |
# 2) Given HTML: "<div class="images"><img src="/pic.jpg"></div>" Using Nokogiri how would you select the src attribute from | |
# the image? Show me two different ways to do that correctly the HTML given. | |
html = Nokogiri::HTML('<div class="images"><img src="/pic.jpg"></div>') | |
w1 = html.css('img')[0]['src'] # => "/pic.jpg" | |
w2 = html.xpath('//img/@src') # => "/pic.jpg" |
NewerOlder