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
diff --git a/grails/src/grails/grails-app/conf/Config.groovy b/grails/src/grails/grails-app/conf/Config.groovy | |
index 63ef42d..0981d5f 100644 | |
--- a/grails/src/grails/grails-app/conf/Config.groovy | |
+++ b/grails/src/grails/grails-app/conf/Config.groovy | |
@@ -35,6 +35,9 @@ grails.enable.native2ascii = true | |
// enable GSP preprocessing: replace head -> g:captureHead, title -> g:captureTitle, meta -> g:captureMeta, body -> g:captureBody | |
grails.views.gsp.sitemesh.preprocess = true | |
+// templates configuration | |
+grails.templates.domainSuffix = 'Instance' |
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
diff --git a/grails/src/java/org/codehaus/groovy/grails/scaffolding/DefaultGrailsTemplateGenerator.groovy b/grails/src/java/org/codehaus/groovy/grails/scaffolding/DefaultGrailsTemplateGenerator.groovy | |
index 02e0335..518d059 100644 | |
--- a/grails/src/java/org/codehaus/groovy/grails/scaffolding/DefaultGrailsTemplateGenerator.groovy | |
+++ b/grails/src/java/org/codehaus/groovy/grails/scaffolding/DefaultGrailsTemplateGenerator.groovy | |
@@ -57,11 +57,10 @@ class DefaultGrailsTemplateGenerator implements GrailsTemplateGenerator, Resourc | |
*/ | |
DefaultGrailsTemplateGenerator(ClassLoader classLoader) { | |
engine = new SimpleTemplateEngine(classLoader) | |
- def suffix = ConfigurationHolder.config?.grails?.templates?.domainSuffix | |
- if (suffix == [:]) { // default for compatibility |
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
// Japanese only | |
// http://imihu.blog30.fc2.com/blog-entry-3151.html | |
def dict = [ | |
A:"あん!", | |
B:"んあっ…!", | |
C:"んあんあ!", | |
D:"んああ!", | |
E:"あ!", | |
F:"ああんあ!", | |
G:"んっあ!", |
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
fact = { n -> | |
isEnd = n <= 1 | |
work = isEnd ? 1 : fact(n - 1) | |
result = n * work as long | |
} | |
max = args[0] as long | |
range = 1..max | |
range.each { num -> | |
fact num | |
println "$num! => $result" |
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
// g100pon *9 Jakarta POI のGroovyサンプル | |
// | |
// usage: groovy sampleOfPOI.groovy <入力Excelファイル> <出力Excelファイル名> | |
// 入力用に適当なExcelファイルを用意してください | |
// ---------------------------- | |
// Grapeによるライブラリ取得 | |
@Grab(group='org.apache.poi', module='poi', version='3.5-beta3') | |
import org.apache.poi.hssf.usermodel.* | |
import org.apache.poi.poifs.filesystem.* |
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
// g100pon *9 Jakarta POI のGroovyサンプル | |
// | |
// usage: groovy sampleOfGExcelAPI.groovy <入力Excelファイル> | |
// 入力用に適当なExcelファイルを用意してください | |
// ---------------------------- | |
// Grapeによるライブラリ取得 | |
@GrabResolver(name="kobo-repo", root="http://github.com/kobo/maven-repo/raw/master/snapshot") | |
@GrabConfig(systemClassLoader=true) // for workaround a permgen problem with GroovyServ | |
@Grab("org.jggug.kobo:gexcelapi:0.2-SNAPSHOT") |
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
// g100pon #57 GStringが遅延評価ぽくなるケース | |
String s1 = "こんにちは" | |
String s2 = "g100pon" | |
def gstrFixed = "${s1}、${s2}です" // 文字列としてGStringに埋め込むのでこの時点で確定している | |
def gstrLazy = "${->s1}、${->s2}です" // Closureでくるむことで評価を遅延させる | |
assert gstrFixed.toString() == "こんにちは、g100ponです" | |
assert gstrLazy.toString() == "こんにちは、g100ponです" |
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.io.*; | |
class Hoge { | |
public static void main(String[] args) throws Exception { | |
try (BufferedInputStream is = new BufferedInputStream( new FileInputStream(new File("/tmp/hoge"))); | |
BufferedOutputStream os = new BufferedOutputStream(new FileOutputStream(new File("/tmp/foo")))) { | |
int length = 0; | |
byte[] buffer = new byte[1024]; | |
while ((length = is.read(buffer)) >= 0) { | |
System.out.write(buffer, 0, length); |
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
#!/bin/sh | |
if [ "$1" == "" ];then | |
echo "Usage: `basename $0` <GIST_ID>" >&2 | |
exit | |
fi | |
GIST_ID=$1 | |
wget https://gist.github.com/gists/$GIST_ID/download -O - 2>/dev/null | tar zxvf - -O - 2>/dev/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
import java.util.*; | |
class Diamond6 { | |
public static void main(String[] args) { | |
List<String> grandchild1 = Arrays.asList("A-1", "A-2", "A-3"); | |
List<String> grandchild2 = Arrays.asList("B-1", "B-2", "B-3"); | |
List<String> grandchild3 = Arrays.asList("C-1", "C-2", "C-3"); | |
Map<Integer, List<String>> child1 = new HashMap<Integer, List<String>>(); | |
child1.put(1, grandchild1); |
OlderNewer