Skip to content

Instantly share code, notes, and snippets.

View kiy0taka's full-sized avatar
🔒

Kiyotaka Oku kiy0taka

🔒
View GitHub Profile
@kiy0taka
kiy0taka / GaelykSetup.groovy
Created October 24, 2009 11:38
[Groovy] Generate new Gaelyk project for Eclipse
import java.util.zip.*
import org.tmatesoft.svn.core.internal.io.dav.*
import org.tmatesoft.svn.core.wc.*
import org.tmatesoft.svn.core.*
/*
Generate new Gaelyk project for Eclipse.
Usage: groovy GaelykSetup.groovy projectName [gaelykTemplateVersion]
@kiy0taka
kiy0taka / tree.md
Created April 24, 2012 09:56 — forked from timyates/tree.md
A one-line tree in Groovy

One line Tree in Groovy

The other day, I saw Harold Cooper's One-line tree in Python via autovivication, and wondered if the same thing was possible in Groovy.

The answer is yes! But you need to define the variable tree before you can assign it to the self-referential withDefault closure, hence with Groovy, it's a two-line solution ;-)

Anyway, given:

def tree = { [:].withDefault{ owner.call() } }
@kiy0taka
kiy0taka / h2console.groovy
Created November 27, 2010 14:33
H2 Web Console
@Grab('org.mortbay.jetty:jetty-embedded:6.1.25')
@Grab('com.h2database:h2:1.2.144')
@Grab('mysql:mysql-connector-java:5.1.13')
import org.mortbay.jetty.Server
import org.mortbay.jetty.servlet.Context
import org.h2.server.web.WebServlet
def server = new Server(8080)
new Context(server, "/", Context.SESSIONS).addServlet(WebServlet, "/*")
server.start()
@kiy0taka
kiy0taka / DbUnitSampleTest.groovy
Created January 8, 2010 15:40
[Groovy][DbUnit] Using DbUnit with Groovy
import groovy.grape.Grape
import groovy.sql.Sql
import groovy.xml.StreamingMarkupBuilder
import org.dbunit.*
import org.dbunit.dataset.xml.*
import org.dbunit.database.*
@Grab('org.dbunit:dbunit:2.4.7')
@Grab('org.slf4j:slf4j-nop:1.5.10')
class DbUnitSampleTest extends GroovyTestCase {
@kiy0taka
kiy0taka / Sftp.groovy
Created December 29, 2009 12:51
Groovy/Commons VFS/SFTP
@Grab('commons-vfs:commons-vfs:1.0')
@Grab('com.jcraft:jsch:0.1.42')
import com.jcraft.jsch.*
import org.apache.commons.vfs.*
import org.apache.commons.vfs.provider.sftp.*
def url = 'sftp://username@host[:port]/path'
def keyFilePath = 'path/to/keyfile'
def passphrase = 'passphrase'
@kiy0taka
kiy0taka / データ移行.md
Last active August 8, 2017 23:46 — forked from chihiro-adachi/データ移行.md
データ移行.md

3.0.x - > 3.nへのデータ移行

3.0.xのデータを抽出し、DataFixtureで読み込み可能なCSVへ変換する

以下の操作で3.0.xデータを3.nで移行できるようにする(イメージ)

cd /path/to/eccube30
php app/console convert::3n /path/to/eccube3n/src/Resouce/doctrine/import_csv
import com.intellij.patterns.PsiJavaPatterns
import com.intellij.patterns.PlatformPatterns
def ctx = context(
ctype: PsiJavaPatterns.psiClass().withName(PlatformPatterns.string().matches(/.*/))
)
contributor(ctx) {
def path = ""
try {
import static org.vertx.groovy.core.streams.Pump.createPump
def conf = [
"crash.auth": "simple",
"crash.auth.simple.username": "admin",
"crash.auth.simple.password": "admin",
"crash.ssh.port": "2000"
]
container.deployModule("org.crashub~vertx.shell~2.0.2", conf)
contributor(context(scope:scriptScope())) {
property name:'vertx', type:'org.vertx.java.core.impl.DefaultVertx'
}
ratpack {
modules {
register(new AbstractModule() {
protected void configure() {
MongoDatastoreConfigurer.configure("myDatabase", Book)
}
})
}
}