Skip to content

Instantly share code, notes, and snippets.

View irof's full-sized avatar
🏠
Working from home

irof irof

🏠
Working from home
View GitHub Profile
package org.mikeneck.twr.api;
import org.mikeneck.twr.exception.*;
/**
* @author : mike
* @since : 12/12/26
*/
public enum ExecutionPatterns {
@irof
irof / HttpServer.java
Created September 28, 2012 15:13
不完全なHTTPサーバ
package httpserver;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.Writer;
import java.net.InetSocketAddress;
import java.net.ServerSocket;
@irof
irof / gist:1361388
Created November 13, 2011 00:57
JUnitでAssertを使わずSystem.out.printlnするひとに警告する
System.setOut(new PrintStream(new OutputStream() {
@Override
public void write(int b) throws IOException {
throw new RuntimeException("Assert使え(#゚Д゚)ゴルァ!!");
}
}));
// こちらは以前試していた失敗作
class DoWhile {
def proc
def _do(Closure proc) {
this.proc = proc
return this
}
def _while(Closure cond) {
10.times {
println cond()
@irof
irof / replace.groovy
Created May 16, 2011 04:24 — forked from kyonmm/replace.groovy
指定ディレクトリ配下のファイルの改行コードを変換する
new File("src").eachFileRecurse(groovy.io.FileType.FILES) {
def s = it.text.replaceAll(/\r\n?/,'\n')
it.withWriter("UTF-8") {it << s}
}