Skip to content

Instantly share code, notes, and snippets.

@weihsiu
weihsiu / interpreter.scala
Created March 11, 2012 03:27 — forked from chrislewis/interpreter.scala
quick interpreter for nescala
package necsala.embedded
import scala.tools.nsc.interpreter.AbstractFileClassLoader
import scala.tools.nsc.{Global, Settings}
import scala.tools.nsc.util.BatchSourceFile
import scala.tools.nsc.io.{AbstractFile, VirtualDirectory}
import java.io.File
import java.util.jar.JarFile
import java.net.URLClassLoader
@weihsiu
weihsiu / cake_pattern_di.scala
Created November 19, 2011 17:43 — forked from HarryHuang/cake_pattern_di.scala
Scala Dependency Injection: an improved cake pattern
//harry huang [huanghui.huang@gmail.com]
//
//After reading the original post [http://jboner.github.com/2008/10/06/real-world-scala-dependency-injection-di.html, ]
//the original cake pattern seems quite verbose for me, and it is quite invasive, so I spent a bit time
//and come up with an improved version of cake pattern, which I call it a "Auto Cake DI". It is working
//well with any POST(plain old scala trait)/POSO(plain old scala object) which means that anything can be
//injected without modification or introducing new traits.
/*---------inject trait---------*/
trait Inject[+T] { def inject: T }