Skip to content

Instantly share code, notes, and snippets.

View tyama's full-sized avatar
💤

Tsuyoshi Yamamoto tyama

💤
  • newcast inc.
  • Tajimi,Japan
  • 00:36 (UTC +09:00)
View GitHub Profile
package app;
import org.springframework.beans.MutablePropertyValues;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.beans.factory.support.GenericBeanDefinition;
import org.springframework.boot.SpringApplication;
import org.springframework.http.MediaType;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.http.server.ServletServerHttpResponse;
import org.springframework.web.servlet.ModelAndView;
@tyama
tyama / boot-gorm-hibernate4.groovy
Last active August 29, 2015 14:18 — forked from graemerocher/boot-gorm-hibernate4.groovy
Using GORM for Hibernate 4 in Spring Boot
@Grab("org.grails:gorm-hibernate4-spring-boot:1.1.0.RELEASE")
@Grab("com.h2database:h2:1.3.173")
import grails.persistence.*
import org.springframework.http.*
import static org.springframework.web.bind.annotation.RequestMethod.*
// curl -XPOST http://localhost:8080/person/add -F 'firstName=Tony'
// curl -XGET 'http://localhost:8080/person/greet?firstName=Tony'
@RestController
class GreetingController {
@tyama
tyama / script-gorm-mongodb.groovy
Last active August 29, 2015 13:57 — forked from graemerocher/script-gorm-mongodb.groovy
Using GORM for MongoDB in a Groovy Script
@Grab("org.grails:grails-datastore-gorm-mongodb:4.0.0.RELEASE")
@Grab("org.springframework:spring-expression:4.1.6.RELEASE")
@Grab('org.slf4j:slf4j-simple:1.7.12')
import grails.persistence.*
import grails.mongodb.geo.*
import grails.mongodb.bootstrap.*
import org.bson.types.ObjectId
import com.mongodb.BasicDBObject
def initializer = new MongoDbDataStoreSpringInitializer(City)
@tyama
tyama / boot-gorm-mongodb.groovy
Last active August 29, 2015 13:57 — forked from graemerocher/boot-gorm-mongodb.groovy
Using GORM for MongoDB in Spring Boot
@Grab('org.grails:gorm-mongodb-spring-boot:1.1.0.RELEASE')
import grails.persistence.*
import grails.mongodb.geo.*
import org.bson.types.ObjectId
import com.mongodb.BasicDBObject
import com.mongodb.Mongo
import org.springframework.http.*
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.data.mongodb.core.mapping.MongoMappingContext
import static org.springframework.web.bind.annotation.RequestMethod.*
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 {
@GrabResolver(name='grails-core', root='http://repo.grails.org/grails/core')
@Grab(group='org.grails', module='grails-datastore-gorm-mongo', version='1.0.0.BUILD-SNAPSHOT')
@Grab(group='org.slf4j', module='slf4j-simple', version='1.6.1')
import grails.persistence.*
import org.grails.datastore.gorm.mongo.config.*
MongoDatastoreConfigurer.configure("myDatabase", Book)
Book.withSession {
@Grab('com.gmongo:gmongo:0.9.5')
@GrabConfig(systemClassLoader=true)
import com.gmongo.GMongo
import com.mongodb.*
import javax.swing.UIManager
import groovy.ui.Console
import org.codehaus.groovy.control.CompilerConfiguration
import org.codehaus.groovy.control.customizers.ImportCustomizer
import groovy.transform.*
/*
Kiwanuji on JVM
http://kihwanujish.jottit.com/
*/
バブン = {println it}
シココケ = {a,b-> assert a==b}
バブン "オグモ ハイジ"
ラダ = "ゲボ"
シココケ(ラダ,"ゲボ")
@tyama
tyama / gist:624129
Created October 13, 2010 14:29 — forked from nobeans/gist:619325
// 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")
@Grab('pircbot:pircbot:1.4.2')
import org.jibble.pircbot.*;
def (host, port, channel) = ['<Server>', <Port>, '<Channel>']
def bot = [:] as PircBot
bot.name = 'groovy_bot'
bot.encoding = 'ISO-2022-JP'
bot.connect host, port
bot.joinChannel channel