如果在jruby想操作java的interface,如Runnable
直接include但不override需要的method,在還沒有執行前都是不會出現錯誤的
| //我需要的用法是 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); |
| //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) { |
| # 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 |
| import java.util.ArrayList; | |
| import java.util.List; | |
| import java.util.Random; | |
| public class Father { | |
| public static void main(String[] args) { | |
| int testNum = 10; | |
| boolean maskResponse = true; |
| /** | |
| * box-shadow vs filter: drop-shadow | |
| */ | |
| body { | |
| background: #ddd; | |
| font: 16px/1 sans-serif; | |
| } | |
| div { | |
| margin: 100px; |
| |test.rb | |
| |less | |
| |-test.less |
| isWithoutNull("a") #true | |
| isWithoutNull("a", null) #false | |
| isWithoutNull(null) #false | |
| isWithoutNull(1) #true | |
| isWithoutNull(1, window.a) #false |
| #!/usr/bin/env bash | |
| curl https://s3.amazonaws.com/heroku-jvm-buildpack-vi/vim-7.3.tar.gz --output vim.tar.gz | |
| mkdir vim && tar xzvf vim.tar.gz -C vim | |
| export PATH=$PATH:/app/vim/bin |