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
#!/usr/bin/env ruby | |
srand(Time.local(2012, 8, 2).to_i) | |
class Member | |
attr_reader :name, :power | |
def initialize(name) | |
@name = name | |
@power = rand | |
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
#!/usr/bin/env ruby | |
class Member | |
attr_reader :name | |
def initialize(name) | |
@name = name | |
end | |
def win?(opponent) | |
result_table = { gu: { gu: :even, choki: :win, pa: :lose }, |
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
#!/usr/bin/env ruby | |
class Member | |
attr_reader :name | |
def initialize(name) | |
@name = name | |
end | |
end | |
class Symbol |
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
#!/usr/bin/env ruby | |
class Member | |
attr_reader :name | |
def initialize(name) | |
@name = name | |
end | |
def win?(opponent) | |
raise 'should be overrided' | |
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
#!/usr/bin/env ruby | |
class Member | |
attr_reader :name | |
def initialize(name) | |
@name = name | |
end | |
def hand |
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
import scala.util.Random | |
object lunch_script { | |
def main(args: Array[String]) : Unit = { | |
val splitMember = shuffleAndSplit(args.toList, 20121018) | |
println(splitMember._1) | |
println(splitMember._2) | |
} | |
def shuffleAndSplit(member: List[String], date: Long) : (List[String], List[String]) = { |
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
#!/bin/env ruby | |
# -*- coding: utf-8 -*- | |
require 'open-uri' | |
require 'nokogiri' | |
require 'pry' | |
doc = Nokogiri::HTML(open('http://www.wizards.com/magic/tcg/article.aspx?' + | |
'x=mtg/tcg/dragonsmaze/cig', | |
'Accept-Language' => 'ja,en-US;q=0.8,en;q=0.6')) |
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
foreach (debug_backtrace() as $func) | |
{ | |
\Log::warning($func['file'] . ' - ' . $func['class'] . $func['type'] | |
. $func['function'] . '(' . $func['args'] . ')[L' . $func['line'] . ']'); | |
} |
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
# play-jsonからhoconフォーマットへだいたい変換するスクリプト | |
# Seqだけはカッコが同一行へ存在しないと変換を失敗する | |
sed -i -e 's/Json.obj(/{/g' $1 | |
sed -i -e 's/ -> /: /g' $1 | |
sed -i -e 's/,$//g' $1 | |
sed -i -e 's/Seq(\(.*\))/[\1]/g' $1 | |
sed -i -e 's/L$//g' $1 | |
sed -i -e 's/)/}/g' $1 | |
sed -i -e 's/^\(\s*\)"\([^"]*\)"/\1\2/g' $1 |
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
val scoobiRun = taskKey[Int]("A sample int task.") | |
scoobiRun := { | |
(compile in Compile).value | |
println(1) | |
1 | |
} |
OlderNewer