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
-------------------------------------------------------------------------------- | |
-- count(*) | |
-------------------------------------------------------------------------------- | |
18:18:19 SQL> select count(*) from message; | |
COUNT(*) | |
---------- | |
17718 | |
経過: 00:00:00.04 |
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.util.Iterator | |
fun main(args: Array<String>) { | |
fibonacci(1000).forEach {println(it)} | |
} | |
fun fibonacci(max: Int): Iterator<Int> { | |
var current = #(1, 1) | |
return iterate<Int> { | |
val next = current._1 + current._2 |
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
select case | |
when mod(seq.col1, 3) = 0 and mod(seq.col1, 5) = 0 then | |
'fizzbuzz' | |
when mod(seq.col1, 3) = 0 then | |
'fizz' | |
when mod(seq.col1, 5) = 0 then | |
'buzz' | |
else | |
to_char(seq.col1) | |
end fizzbuzz |
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
class Hogehoge { | |
def cls = {} | |
static hogefuga = {} | |
} | |
cls = {} | |
def cls2 = {} | |
def method(Closure c) { | |
println getDeclaredName(c) |
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 siosio.validator | |
import grails.validation.ValidationErrors | |
import org.junit.Test | |
import org.junit.Before | |
class NumCharValidatorTest { | |
NumCharValidator validator |
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 siosio.validator | |
import org.codehaus.groovy.grails.validation.AbstractConstraint | |
import org.springframework.validation.Errors | |
class NumCharValidator extends AbstractConstraint { | |
public static final NAME = "number" | |
private static final String DEFAULT_MESSAGE = "default.invalid.number.message" |
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
class Buzz implements Comparable<Buzz> { | |
private int index | |
private Buzz(int index) { | |
this.index = index | |
} | |
def static start(int index) { | |
while (!isBuzz(index)) {index++} |
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>) { | |
println (30.buzzbuzz().toList()) | |
} | |
fun Int.buzzbuzz(): java.util.Iterator<Int> { | |
var buzz = #(0, 0) | |
fun Int.range(size:Int) = (this + 1 .. this + size) | |
fun buzzer() = { | |
if (buzz._1 >= this) { | |
null |
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
apply plugin: 'java' | |
defaultTasks 'build' | |
sourceSets { | |
main { | |
java { | |
srcDir 'main/java' | |
} | |
} |
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.util.Collection | |
fun IntRange.fizzBuzz() = this.map { | |
when (#(it % 3, it % 5)) { | |
is #(0, 0) -> "fizzbuzz" | |
is #(0, *) -> "fizz" | |
is #(*, 0) -> "buzz" | |
else -> "" | |
} | |
} |