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
diff --git a/chapter5/bond-nokogiri.rb b/chapter5/bond-nokogiri.rb | |
index 62564d0..ff4c740 100644 | |
--- a/chapter5/bond-nokogiri.rb | |
+++ b/chapter5/bond-nokogiri.rb | |
@@ -3,7 +3,7 @@ require 'nokogiri' | |
require 'open-uri' | |
url="http://www.mof.go.jp/jgbs/reference/interest_rate/jgbcm.htm" | |
-reg_pattern="//*[@id='index']/tbody/tr/td/ul/table[3]/tbody/tr" | |
+reg_pattern="//*[@id='index']/tbody/tr/td/ul/table[2]/tbody/tr" |
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
diff --git a/chapter5/flickr-nokogiri.rb b/chapter5/flickr-nokogiri.rb | |
index bfa87cb..da46acc 100644 | |
--- a/chapter5/flickr-nokogiri.rb | |
+++ b/chapter5/flickr-nokogiri.rb | |
@@ -14,7 +14,7 @@ def save_image(url) | |
end | |
search_word=URI.encode("cat") | |
-doc = Nokogiri::HTML(open("https://www.flickr.com/search/?q=#{search_word}")) | |
+doc = Nokogiri::HTML(open("https://www.flickr.com/search/?text=#{search_word}")) |
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
diff --git a/chapter4/anemone-errorcode.rb b/chapter4/anemone-errorcode.rb | |
index 2e08289..d532bfb 100644 | |
--- a/chapter4/anemone-errorcode.rb | |
+++ b/chapter4/anemone-errorcode.rb | |
@@ -12,9 +12,9 @@ opts = { | |
Anemone.crawl(urls, opts) do |anemone| | |
anemone.on_every_page do |page| | |
puts page.url | |
- raise '500 Error!:' + page.url.path.to_s if page.code = 500 | |
+ raise '500 Error!:' + page.url.path.to_s if page.code == 500 |
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
diff --git a/chapter2/scraping-with-cookie.rb b/chapter2/scraping-with-cookie.rb | |
index 7d5b289..d3d07cd 100644 | |
--- a/chapter2/scraping-with-cookie.rb | |
+++ b/chapter2/scraping-with-cookie.rb | |
@@ -24,8 +24,10 @@ opts = { | |
Anemone.crawl(urls, opts) do |anemone| | |
anemone.on_every_page do |page| | |
doc = Nokogiri::HTML.parse(page.body.toutf8) | |
- communityList.each {|community| | |
+ community_list = doc.xpath("//*[@id='communityList']/div[2]/table/tr/td")^M |
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
delimiter // | |
DROP PROCEDURE IF EXISTS all_tables_count// | |
CREATE PROCEDURE all_tables_count( | |
IN schemaName VARCHAR(100) | |
) | |
BEGIN | |
DECLARE done INT; | |
DECLARE _tableName VARCHAR(100); | |
DECLARE cur CURSOR FOR | |
select TABLE_NAME from information_schema.tables where TABLE_SCHEMA = schemaName order by TABLE_NAME; |
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
--- mod_auth_mysql.c 2005-06-23 01:17:45.000000000 +0900 | |
+++ ../../mod_auth_mysql-3.0.0/mod_auth_mysql.c 2013-12-27 15:02:59.000000000 +0900 | |
@@ -206,7 +206,7 @@ | |
#define SNPRINTF apr_snprintf | |
#define PSTRDUP apr_pstrdup | |
#define PSTRNDUP apr_pstrndup | |
- #define STRCAT ap_pstrcat | |
+ #define STRCAT apr_pstrcat | |
#define POOL apr_pool_t | |
#include "http_request.h" /* for ap_hook_(check_user_id | auth_checker)*/ |
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: utf-8 | |
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'pismo' | |
module Ogura100 | |
URL = 'http://ja.wikisource.org/wiki/%E5%B0%8F%E5%80%89%E7%99%BE%E4%BA%BA%E4%B8%80%E9%A6%96' | |
class Scrape | |
def run |
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
#!/usr/bin/env ruby | |
class TreeNodeData < Array | |
def <<(ary) | |
raise ArgumentError unless ary.size == 2 | |
super | |
end | |
def child_data | |
self[0] | |
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
require 'spec_helper' | |
require 'idemitsu_importer' | |
describe Idemitsu::Importer do | |
describe "サンプルデータのimport" do | |
before do | |
@header, @data = Idemitsu::Importer.import('spec/fixtures/IDEMITSU_1303.csv') | |
end | |
describe "CSVファイルのheader" do |
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
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> | |
<script> | |
// タグクラウドもどき | |
(function($) { | |
$(function() { | |
var MAX_LEVEL = 6; | |
var ZOOM_INCREASE = 0.4; | |
var maxCount = 0; | |
var categories = $(".hatena-module-category ul li a"); | |
// 一番大きなタグを取得 |