Skip to content

Instantly share code, notes, and snippets.

@osima
osima / xmltest.groovy
Created January 23, 2012 05:04
test XmlParser and XmlNodePrinter
def fix = { String text->
def out=''<<''
new StringReader(text).each{ out << it.trim() }
out.toString()
}
@osima
osima / resize_png_image.groovy
Created January 16, 2012 15:29
resize all png images in current dir.
import java.awt.Image
import java.awt.image.BufferedImage
import javax.imageio.ImageIO
class Conv {
File inputFile
File outputFile
@osima
osima / MyMacroFilter.groovy
Created January 15, 2012 03:59
ore-ore-macro-test code
class MyMacroFilter extends org.radeox.filter.MacroFilter {
private MacroRepository macros
private MacroRepository getMacros(){
if(macros==null)
macros = new MacroRepository()
macros
}
public void setInitialContext(InitialRenderContext context) {
getMacros().setInitialContext(context)
@osima
osima / markdown_to_textile.groovy
Created January 14, 2012 23:40
markdown to textile converter another version without radeox
//
// markdown から textile への変換だけする
//
import java.util.regex.*
class Conv {
@osima
osima / markdown_to_textile.groovy
Created January 14, 2012 23:14
code sketch for markdown-to-textile convert with radeox
@Grab(group='radeox', module='radeox', version='1.0-b2')
import org.radeox.api.engine.context.InitialRenderContext
import org.radeox.engine.*
import org.radeox.engine.context.*
import org.radeox.filter.*
import org.radeox.filter.context.*
@osima
osima / ProcessFlateDecode.java
Created January 14, 2012 23:05
decode flate-decode part how to in pdf
import java.io.*;
import java.util.*;
import java.util.zip.*;
class ProcessFlateDecode {
private File f;
public ProcessFlateDecode(File f){
this.f=f;
@osima
osima / gist-fetcher.groovy
Created January 14, 2012 03:35
fetch code from gist using gist api v3.
@Grab(group='commons-httpclient', module='commons-httpclient', version='3.1')
import org.apache.commons.httpclient.*
import org.apache.commons.httpclient.methods.*
import groovy.json.*
class GistFetcher {
@osima
osima / markupBuilderTest.groovy
Created January 13, 2012 09:17
MarkupBuilderの記述で共通部分をまとめる
import groovy.xml.MarkupBuilder
import groovy.xml.MarkupBuilderHelper
def builder = new MarkupBuilder()
builder.root() {
eps() {
src('foo/1.eps')
}
textframe() {
@osima
osima / textile2html.groovy
Created December 7, 2011 08:20
convert textile to html using textile-j
//
// convert textile to html using textile-j
//
@Grab(group='net.java', module='textile-j', version='2.2')
import net.java.textilej.parser.MarkupParser;
import net.java.textilej.parser.builder.HtmlDocumentBuilder;
import net.java.textilej.parser.markup.textile.TextileDialect;
@osima
osima / fetchCodeFromGist.groovy
Created December 7, 2011 04:48
fetch code from gist using groovy
//
// fetch code from gist using groovy
//
@Grab(group='commons-httpclient', module='commons-httpclient', version='3.1')
import org.apache.commons.httpclient.*
import org.apache.commons.httpclient.methods.*
def encoding = 'UTF-8'