Skip to content

Instantly share code, notes, and snippets.

View kiy0taka's full-sized avatar
🔒

Kiyotaka Oku kiy0taka

🔒
View GitHub Profile
http://griffon.codehaus.org/
http://griffon.codehaus.org/guide/latest/
http://artifacts.griffon-framework.org/
curl -s get.gvmtool.net | bash
gvm install griffon
griffon create-app sample
griffon integrate-with --intellij
griffon integrate-with --ant
enum Direction { L,U,R,D }
def debug = { directions, button = null ->
def result = """|3${directions[3]}0
|${directions[2]} ${directions[0]}
|2${directions[1]}1""".stripMargin()
if (button != null) result = result.replace("$button", '*')
result
}
@Grab('org.codehaus.groovy.modules.http-builder:http-builder:0.5.2' )
import groovyx.net.http.HTTPBuilder
import static groovyx.net.http.ContentType.*
def jobName = 'hello2'
def contentXml = '''
<?xml version='1.0' encoding='UTF-8'?>
<project>
<actions/>
<description></description>
@kiy0taka
kiy0taka / gist:4387787
Last active December 10, 2015 05:28
GVM Grails/Griffon auto switch for zsh.
__gvm_switch() {
if [ -s "gradle.properties" ]; then
local candidate current target
candidate=grails
target=$(cat gradle.properties | grep --color=never 'grailsVersion' | sed "s_grailsVersion=\(.*\)_\1_g")
if [[ $target != '' ]]; then
current=$(eval echo '$'$(echo $candidate | tr '[:lower:]' '[:upper:]')_HOME | sed -e "s_$GVM_DIR/$candidate/__g")
if [[ $current != $target ]]; then
echo "Switching to $candidate $target ..."
gvm offline enable > /dev/null
@GrabResolver('http://repo.gradle.org/gradle/libs/')
@Grab('org.gradle:gradle-tooling-api:1.0')
import org.gradle.tooling.GradleConnector
import org.gradle.tooling.ProgressListener
import org.gradle.tooling.model.GradleProject
import org.gradle.tooling.model.GradleTask
import groovy.swing.*
import groovy.ui.SystemOutputInterceptor;
import javax.swing.*
import javax.swing.tree.*
griffon install-plugin http://artifacts.griffon-framework.org/repository/plugins/installer/0.6/griffon-installer-0.6.zip
griffon install-plugin http://artifacts.griffon-framework.org/repository/plugins/swingx-builder/0.6/griffon-swingx-builder-0.6.zip
griffon install-plugin http://artifacts.griffon-framework.org/repository/plugins/dialogs/0.3/griffon-dialogs-0.3.zip
griffon install-plugin http://artifacts.griffon-framework.org/repository/plugins/i18n-support/0.2/griffon-i18n-support-0.2.zip
griffon install-plugin http://artifacts.griffon-framework.org/repository/plugins/miglayout/0.4/griffon-miglayout-0.4.zip
griffon install-plugin http://artifacts.griffon-framework.org/repository/plugins/actions/0.4/griffon-actions-0.4.zip
griffon install-plugin http://artifacts.griffon-framework.org/repository/plugins/jide-builder/0.7/griffon-jide-builder-0.7.zip
griffon install-plugin http://artifacts.griffon-framework.org/repository/plugins/syntaxtext/0.2/griffon-syntaxtext-0.2.zip
griffon install-plugin http://artifacts.
<!doctype html>
<html>
<head>
<title>Grails Runtime Exception</title>
<meta name="layout" content="main">
<link rel="stylesheet" href="${resource(dir: 'css', file: 'errors.css')}" type="text/css">
</head>
<body>
<g:renderException exception="${exception}" />
<script>
{"list": [
{
"id": "2.1.0.RC3",
"name": "Grails 2.1.0.RC3",
"url": "http://dist.springframework.org.s3.amazonaws.com/release/GRAILS/grails-2.1.0.RC3.zip"
},
{
"id": "2.0.4",
"name": "Grails 2.0.4",
"url": "http://dist.springframework.org.s3.amazonaws.com/release/GRAILS/grails-2.0.4.zip"
@Grab('com.ibm.icu:icu4j:4.8.1.1')
import com.ibm.icu.text.Transliterator
class StringCategory {
static hankaku = Transliterator.getInstance('Fullwidth-Halfwidth').&transliterate
static String div(String self, int divisor) {
divisor == 2 ? hankaku(self) : self
}
}
@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() } }