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
// ==UserScript== | |
// @name GistViewer | |
// @namespace http://d.hatena.ne.jp/kiy0taka/ | |
// @include * | |
// @exclude http://gist.github.com/* | |
// @exclude http://*.hatena.ne.jp/* | |
// ==/UserScript== | |
(function() { | |
function xpath(query, contextNode) { |
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.awt.Color | |
import groovy.swing.SwingBuilder | |
import griffon.builder.trident.TridentBuilder | |
def trident = new TridentBuilder() | |
def swing = new SwingBuilder() | |
swing.edt { | |
frame( title: "Trident+Groovy", size: [400,200], | |
locationRelativeTo: null, visible: true ) { | |
flowLayout() |
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.beans.Bindable | |
import groovy.swing.SwingBuilder | |
class Foo { | |
@Bindable Bar bar | |
} | |
class Bar { | |
@Bindable String baz | |
} |
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
# Step.1 | |
http://dist.codehaus.org/grails/grails-bin-1.1.1.zip | |
#Grailsの設定 | |
export GRAILS_HOME=/opt/grails-1.1.1 | |
export PATH=$GRAILS_HOME/bin:$PATH | |
#appengine-javaの設定 http://code.google.com/appengine/downloads.html | |
export APPENGINE_HOME=/opt/appengine-java-sdk-1.3.0 |
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
// ==UserScript== | |
// @name pixiv API | |
// @namespace http://efcl.info/ | |
// @include http://www.pixiv.net/* | |
// ==/UserScript== | |
// API 資料 http://pastie.org/735195 | |
var pxvAPI = "http://iphone.pxv.jp/iphone/" | |
// 検索結果のオブジェクト | |
var result = []; | |
var user = { |
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('org.eclipse.jetty:jetty-server:7.0.1.v20091125') | |
@Grab('org.eclipse.jetty:jetty-servlet:7.0.1.v20091125') | |
import org.eclipse.jetty.server.* | |
import org.eclipse.jetty.server.handler.* | |
import org.eclipse.jetty.servlet.* | |
import groovy.servlet.* | |
server = new Server(8080) | |
servletHandler = new ServletContextHandler(ServletContextHandler.SESSIONS) | |
servletHandler.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
import org.codehaus.groovy.groovydoc.GroovyRootDoc | |
import org.codehaus.groovy.tools.groovydoc.GroovyDocTool | |
import static groovy.io.FileType.FILES | |
/** | |
* Generate i18n messages.properties from the domain class comments | |
* | |
* grails generate-i18n-labels | |
* grails generate-i18n-labels {target lang} | |
* grails generate-i18n-labels {lang} {target package} |
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
<?xml version="1.0" ?> | |
<project name="ant-with-groovy" default="test"> | |
<taskdef name="groovy" | |
classname="org.codehaus.groovy.ant.Groovy" | |
classpath="groovy-all-1.7.2.jar" /> <!-- groovy-all-*.jar を指定 --> | |
<target name="test"> | |
<groovy><![CDATA[ | |
// この中にgroovyスクリプトを自由に記述できる。 | |
// このバインディング内で暗黙的に利用可能な変数は以下。 |
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 test(Closure clos) { | |
def localVals = new Object() { | |
def map = [:] | |
def that | |
} | |
clos.delegate = localVals // 参照先を一時変数とする | |
def arg1 = clos.getResolveStrategy() // デフォルトではowner, delegateの順でメソッドやプロパティの存在を確認 | |
localVals.that = 'This is that!' // thatで参照できるようにしてみる。 | |
clos.call(arg1) | |
localVals.map.each { key, value -> |
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 #40 XMLの読み書きを色んな方法で(DOMBuilder->XmlUtil) | |
import groovy.xml.XmlUtil | |
import groovy.xml.dom.DOMCategory | |
import groovy.xml.DOMBuilder | |
// DOMBuilderを使うとパースが簡単にできる | |
// パース結果のオブジェクトはDOM | |
def doc = DOMBuilder.parse( | |
new InputStreamReader(new FileInputStream('sample.xml'),'UTF-8') ) |
OlderNewer