Skip to content

Instantly share code, notes, and snippets.

@sndyuk
sndyuk / runtime mock of structual subtyping.scala
Created November 4, 2012 11:45 — forked from xeno-by/gist:4008389
構造的部分型を引数に持つ関数に対して、実行時に引数を動的に作成して渡す
import scala.language.reflectiveCalls
// for the story behind this snippet of code see:
// http://stackoverflow.com/questions/13185405/structural-subtyping-reflection
// requires Scala 2.10.0-RC1 or higher
// you also need to have scala-reflect.jar and scala-compiler.jar on your classpath
import scala.reflect.runtime.universe._
object Test extends App {
@sndyuk
sndyuk / VirtualExtensionMethod.java
Created July 25, 2012 14:37
Java8 virtual extension method 色々
class VirtualExtensionMethod {
public static void main(String[] args) {
F fa = new FA();
fa.f1("fa");
F fb = new FB();
fb.f2("fb");
}
@sndyuk
sndyuk / Simple_Unit_test_DSL_on_Scala.scala
Created June 26, 2012 02:58
Scalaでタスク管理DSL
package trampoline
import java.text.SimpleDateFormat
import java.util.Date
/**
* Simple Unit test DSL.
*/
class UnitTestContext(val limit: Date)
@sndyuk
sndyuk / FluentLogbackAppender.java
Created January 14, 2012 19:34
Logback appender with fluent-logger-java
package com.example;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.LinkedBlockingQueue;
import org.fluentd.logger.FluentLogger;