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 | |
require 'nokogiri' | |
require 'httparty' | |
require 'pp' | |
base = 'http://www.ptt.cc' | |
url = 'http://www.ptt.cc/bbs/joke/index.html' | |
yesterday = Date.today - 1 | |
stop_flag = false |
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
//FightCode can only understand your robot | |
//if its class is called Robot | |
var Robot = function(robot) { | |
robot.clone(); | |
robot.ahead(100); | |
robot.turn(); | |
}; | |
Robot.prototype.onIdle = function(ev) { |
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
//我需要的用法是 RoadInfo = RoadInfoHash.get(起點).get(終點) | |
//所以RoadInfoHash是一個雙層的HashMap,RoadInfoHash.get(起點)會得到一個HashMap | |
while ((mRi = mRiCursor.next()) != null) { | |
//如果Hash的key內沒這個起點,表示他還沒被new,就new出來,這個if不能拿掉 | |
if( !RoadInfoHash.containsKey(mRi.FNode.NodeId) ) | |
RoadInfoHash.put(mRi.FNode.NodeId, new HashMap<String,RoadInfoPlusEntity>() ); | |
//這個if想拿掉也沒關係,加if是為了不要重複賦值而已 | |
if( !RoadInfoHash.get(mRi.FNode.NodeId).containsKey(mRi.TNode.NodeId) ) | |
RoadInfoHash.get(mRi.FNode.NodeId).put(mRi.TNode.NodeId, mRi); |
NewerOlder