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
fontName = "Menlo" | |
fontSize = 12 | |
myExtraIncludes = ".tm_properties,.htaccess,.git*,.env" | |
fileBrowserGlob = "{*,$myExtraIncludes}" | |
include = "{$include,$myExtraIncludes}" | |
myExtraExcludes = "log,vendor,tmp,*sqlite3,.sass-cache,.DS_Store" | |
excludeInFileChooser = "{$excludeInFileChooser,$myExtraExcludes}" | |
excludeInFolderSearch = "{$excludeInFolderSearch,$myExtraExcludes}" |
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 'nokogiri' | |
require 'open-uri' | |
url = "https://dl.dropbox.com/u/11503045/rbsmp1.html" | |
doc = Nokogiri::HTML(open(url).read, nil, 'Shift_JIS') | |
doc.xpath('//body').children.each_with_index do |item, i| | |
p "#{i}:#{item.text}" | |
p item.text.scan(/\w+/)[0] | |
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
require 'mechanize' | |
agent = Mechanize.new | |
agent.user_agent_alias = 'Mac Safari' | |
uri = URI.parse('http://google.com/') | |
page = agent.get(uri) | |
sbox = page.form_with(name: 'gbqf') | |
sbox.q = 'crucial ssd' | |
result = agent.submit(sbox) |
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 'nokogiri' | |
require 'open-uri' | |
url = "http://tenki.jp/" | |
doc = Nokogiri::HTML(open(url).read) | |
doc.xpath('//ul[@class="localList"]//li').each do |item| | |
# u = item.xpath('.//a').attribute('href') | |
puts item.xpath('.//a').text | |
# puts item.xpath('.//a/attribute::href').first | |
# puts item.search('a').attribute('href') |
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 'nokogiri' | |
require 'open-uri' | |
keyword = "crucial+ssd" | |
page = open("http://kakaku.com/search_results/#{keyword}/?sort=priceb") | |
html = Nokogiri::HTML(page.read, nil, 'Shift_JIS') | |
puts html.xpath('//p[@class="itemnameN"]//a').text | |
puts html.xpath('//span[@class="yen"]//a').text |