Skip to content

Instantly share code, notes, and snippets.

@bluepapa32
bluepapa32 / build.gradle
Created December 27, 2011 22:29
Apache Solr Japanese DEMO with Gradle
import org.apache.solr.common.*
import org.apache.solr.client.solrj.*
import org.apache.solr.client.solrj.impl.*
import org.apache.solr.client.solrj.response.*
basename = "apache-solr-3.5.0"
baseurl = "http://ftp.jaist.ac.jp/pub/apache/lucene/solr/3.5.0"
serverurl = "http://localhost:8983/solr"
buildscript {
@bluepapa32
bluepapa32 / build.gradle
Created December 24, 2011 07:05
Apache Lucene DEMO with Gradle
configurations {
demo
source
}
repositories {
mavenCentral()
}
dependencies {
@bluepapa32
bluepapa32 / build.gradle
Created December 22, 2011 17:50
Apache Solr DEMO with Gradle
import org.apache.solr.common.*
import org.apache.solr.client.solrj.*
import org.apache.solr.client.solrj.impl.*
import org.apache.solr.client.solrj.response.*
basename = "apache-solr-3.5.0"
baseurl = "http://ftp.jaist.ac.jp/pub/apache/lucene/solr/3.5.0"
serverurl = "http://localhost:8983/solr"
buildscript {
@bluepapa32
bluepapa32 / hoge.groovy
Created August 16, 2011 23:49
お題:文字列を先頭から見て同じところまで除去
def hoge(String... args) {
args*.substring(args*.toList().transpose().findIndexOf{ it.unique().size() != 1 })
}
hoge("12345", "67890", "12abc")
@bluepapa32
bluepapa32 / fizzbuzz.groovy
Created August 16, 2011 10:34
お題:FizzBuzz(Nパターン)
def fizzbuzz(from, to, list) {
def i = 0
def dict = list.split{ i++ % 2 == 0 }.transpose()
(from..to).each {
n -> println "${n}: ${dict.inject(''){ s, v -> (n % v[0] == 0) ? s + v[1] : s }}"
}
}
fizzbuzz(1, 100, [3, "Fizz", 5, "Buzz", 7, "Hoge"])
@bluepapa32
bluepapa32 / cobertura.gradle
Created June 17, 2011 03:44
Gradle で Cobertura してみる
configurations{
cobertura
}
dependencies {
cobertura "net.sourceforge.cobertura:cobertura:1.9.4.1"
}
tmpDir = new File(buildDir, "tmp")
@bluepapa32
bluepapa32 / findbugs.gradle
Created June 14, 2011 15:06
Gradle で FindBugs してみる
configurations {
findbugs
}
dependencies {
findbugs "com.google.code.findbugs:findbugs-ant:1.3.9"
}
findbugsOutputDirName = "findbugs"
findbugsReportDir = new File(reportsDir, findbugsOutputDirName)
@bluepapa32
bluepapa32 / emma.gradle
Created June 13, 2011 16:49
Gradle で EMMA してみる
configurations {
emma
}
dependencies {
emma "emma:emma:2.1.5320"
emma "emma:emma_ant:2.1.5320"
}
tmpDir = new File(buildDir, "tmp")
@bluepapa32
bluepapa32 / build.gradle
Created May 6, 2011 15:19
Gradle の Code Quality プラグインでエラーを無視する
apply plugin: 'java'
apply plugin: 'groovy'
apply plugin: 'code-quality'
repositories {
mavenCentral()
}
dependencies {
groovy 'org.codehaus.groovy:groovy:1.7.10'
@bluepapa32
bluepapa32 / build.gradle
Created May 4, 2011 16:01
Gradle で Amazon EC2 に公開鍵をアップロードしてみる
import com.amazonaws.*;
import com.amazonaws.auth.*;
import com.amazonaws.services.ec2.*;
import com.amazonaws.services.ec2.model.*;
buildscript {
repositories { mavenCentral() }
dependencies { classpath 'com.amazonaws:aws-java-sdk:1.1.9' }
}