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 'watir-webdriver' | |
| class Watir::Browser | |
| def visited? url | |
| if @history == nil | |
| return false | |
| end | |
| return @history.index(url) != nil | |
| 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
| import java.io.*; | |
| import java.util.*; | |
| public class ReferenceTest { | |
| public static class Base { | |
| public int value = 0; | |
| } | |
| public static class Wrapper { | |
| private Base base; |
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
| " 実現したい機能 | |
| " * >>, << でインデント調整 | |
| " * ^で先頭へ | |
| " * リターンで">"を自動挿入 | |
| " * 言語用自動インデント機能の挿入 | |
| " Ref. | |
| " http://www.ibm.com/developerworks/jp/linux/library/l-vim-script-1/ | |
| " http://www.ibm.com/developerworks/jp/linux/library/l-vim-script-2/ | |
| " http://nanasi.jp/articles/code/screen/cursor.html | |
| " |
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
| import Text.Printf | |
| printer :: [[Int]] -> IO () | |
| printer = mapM_ (\x -> do | |
| mapM (printf "%3d") x | |
| putStrLn "") | |
| main = printer [[x*y|x<-[1..9]]|y<-[1..9]] |
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
| import System.Random | |
| import System.IO (hFlush, stdout) | |
| exactNum :: String -> String -> Int | |
| exactNum a b = exactNum' 0 a b | |
| where | |
| exactNum' n [] [] = n | |
| exactNum' n (a:as) (b:bs) = exactNum' (if a==b then (n+1) else n) as bs | |
| matchNum :: String -> String -> Int |
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
| sum :: Int -> Int | |
| sum = sum' 0 | |
| where | |
| sum' acc n | n<1 = acc | |
| | otherwise = sum' (acc+n) (n-1) | |
| main = do | |
| putStrLn (show (Main.sum (2^24))) |
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
| import java.util.*; | |
| public class Fib { | |
| Map<Integer,Long> memo; | |
| public Fib() { | |
| memo = new HashMap<Integer,Long>(); | |
| memo.put(0,0L); | |
| memo.put(1,1L); | |
| } |
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
| import java.net.*; | |
| import java.io.*; | |
| import java.util.*; | |
| class IrcSenderSimple { | |
| static void sendString(BufferedWriter bw, String str) { | |
| try { | |
| bw.write(str + "\r\n"); | |
| bw.flush(); | |
| } |
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 | |
| args = STDIN.gets.split(" ").map{|i| i.to_i} | |
| argp = args[0..1] | |
| argv = args[2..3] | |
| argk = args[4] | |
| min = [argp[0],argv[0]].min | |
| max = [argp[1],argv[1]].max |
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/ruby | |
| # http://www.codechef.com/COOK13/problems/DRAGNXOR/ | |
| n = gets.to_i | |
| n.times do | |
| arr = gets.split.map {|i| i.to_i} | |
| bit = 0 | |
| [1,2].each do |i| | |
| while arr[i] > 0 | |
| bit += arr[i] % 2 | |
| arr[i] /= 2 |
NewerOlder