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
data class UserPostBody(val age: Int?, | |
val name: String?) | |
@JvmName("intConstraint") | |
fun <T> ValidatorBuilder<T>.constraint(prop: KProperty1<T, Int?>, block: IntegerConstraint<T>.() -> Unit): ValidatorBuilder<T> { | |
return this.constraint(prop, prop.name) { it.apply(block) } | |
} | |
@JvmName("charSequenceConstraint") | |
fun <T, E : CharSequence?> ValidatorBuilder<T>.constraint(prop: KProperty1<T, E>, block: CharSequenceConstraint<T, E>.() -> Unit): ValidatorBuilder<T> { |
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
/** | |
* 実行結果例: | |
* ドコズンズンズンズンズンズンドコズンドコドコドコズンドコズンズンズンドコズンズンズンズンドコキ・ヨ・シ! | |
* ドコズンドコズンドコズンドコドコドコドコ┗(^o^)┛wwwwww┏(^o^)┓ドコドコドコドコwwwwwww | |
*/ | |
fun キヨシ() { | |
val random = Random() | |
fun next() = if (random.nextBoolean()) "ズン" else "ドコ" | |
tailrec fun go(zunOrDoko: String, zunCount: Int, dokoCount: Int) { | |
print(zunOrDoko) |
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 Option.None | |
import Option.Some | |
interface Type<out A, out B: Type<A, B>> | |
sealed class Option<out A>: Type<A, Option<A>> { | |
object None: Option<Nothing>() { | |
override fun toString(): String = "None" | |
} |
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 com.google.inject.Guice | |
import javax.inject.Inject | |
import kotlin.properties.Delegates | |
class Greeter { | |
fun greet() { | |
println("Hello") | |
} | |
} |
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
// TODO かっこよくする | |
use std::io; | |
use std::rand; | |
const MAX: uint = 100; | |
fn main() { | |
println!("数当てゲーム"); | |
println!("範囲: 0~{}", MAX); |
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
fun main(args : Array<String>) { | |
} | |
enum class TicketStatus { | |
OPEN | |
FIXED | |
} | |
trait Ticket { | |
val id: Long |
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
package com.taroid.scala.practice | |
import scala.annotation.tailrec | |
object SlidePuzzle { | |
def main(args: Array[String]) { | |
val board = Board(List(3, 1, 2, 4, 0, 5, 6, 7, 8), 3, 0) | |
solve(List(new History(List(board)))).boards.foreach(println) |
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
package com.taroid.scala.practice | |
import scala.collection.immutable.Queue | |
object OnePersonGame { | |
def main(args: Array[String]) { | |
import Operations._ | |
test(solve(List()), List()) | |
test(solve(List(5)), List(REMOVE)) |
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
package com.taroid.ekisample | |
import scala.collection.mutable | |
import scala.xml.XML | |
import java.net.URLEncoder | |
object Main { | |
def main(args: Array[String]) { | |
val shiritori = new Shiritori() |
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 java.awt.AWTException; | |
import java.awt.MouseInfo; | |
import java.awt.Point; | |
import java.awt.Robot; | |
import java.awt.event.InputEvent; | |
public class Main { | |
public static void main(String[] args) throws InterruptedException, AWTException { | |
final Robot robot = new Robot(); |
NewerOlder