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 sample | |
class Book { | |
String title | |
Integer price | |
static constraints = { | |
} | |
} |
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
add-proxy | |
clear-proxy | |
create-hibernate-cfg-xml | |
create-multi-project-build | |
create-pom | |
create-scaffold-controller | |
install-dependency | |
install-plugin | |
install-templates | |
integrate-with |
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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
#if (${PACKAGE_NAME} != "") package ${PACKAGE_NAME} #end | |
import spock.lang.Specification | |
#parse("File Header.java") | |
class ${NAME} extends Specification { | |
} |
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
111 |
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
buildGradle = '''\ | |
apply plugin: 'groovy' | |
apply plugin: 'idea' | |
apply plugin: 'eclipse' | |
repositories { | |
mavenCentral() | |
} | |
dependencies { |
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 spock.lang.FailsWith | |
import spock.lang.Specification | |
class MockAndStubSpec extends Specification { | |
@FailsWith(AssertionError) | |
def "MockとStubを別のインタラクションとして宣言できない"() { | |
setup: | |
def publisher = new Publisher() |
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 groovy.sql.Sql | |
class DatabaseCleaner { | |
static excludes = ["databasechangelog", "databasechangeloglock"] | |
static clean(sql) { | |
// テーブルデータの削除 | |
sql.eachRow("SELECT tablename FROM pg_tables WHERE schemaname = 'public';") { row -> | |
if (row.tablename in excludes) return |
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
@Grab('com.googlecode.gbench:gbench:0.3.1-groovy-2.0') | |
import groovyx.gbench.BenchmarkBuilder | |
import java.security.MessageDigest | |
def r = new BenchmarkBuilder().run { | |
'sha256' { | |
def digest = MessageDigest.getInstance("SHA-256") | |
1000000.times { digest.digest("$it".getBytes("UTF-8")) } | |
} | |
'sha512' { |
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
def chars = 'a'..'g' | |
// collate(int size) | |
// sizeの個数ごとにサブリストを作ってくれる | |
assert chars.collate(3) == [['a', 'b', 'c'], ['d', 'e', 'f'], ['g']] | |
assert chars.collate(5) == [['a', 'b', 'c', 'd', 'e'], ['f', 'g']] | |
// collate(int size, int step) | |
// stepの数毎にsizeの個数をとってサブリストを作ってくれる | |
assert chars.collate(4, 2) == [['a', 'b', 'c', 'd'], ['c', 'd', 'e', 'f'], ['e', 'f', 'g'], ['g']] |
NewerOlder