This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.opensource.aloiscochard; | |
import java.util.Map; | |
import java.util.TreeMap; | |
/** | |
* This class handle simple translation of index (coordonate).<br> | |
* <i>N.B. can be used when translating index during string manipulation.</i> | |
* @author [email protected] | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Sample usage of ... | |
// - Dispatch (http://dispatch.databinder.net) | |
// - SJSON (https://github.com/debasishg/sjson) | |
// ... to create a basic REST Web Service client for Twitter API | |
import dispatch._ | |
import scala.reflect.BeanInfo | |
import sjson.json.Serializer.SJSON | |
// Model |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
///////////////////////// | |
// Dependency Injector // | |
///////////////////////// | |
import scala.collection.immutable.HashMap | |
object Injector { | |
private var registry = new HashMap[java.lang.Class[_], Any] | |
def inject[T : Manifest] : T = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.concurrent.ScheduledThreadPoolExecutor | |
import java.util.concurrent.TimeUnit | |
import scala.actors.scheduler.ExecutorScheduler | |
import scala.tools.nsc | |
import nsc.Phase | |
import nsc.plugins.PluginComponent | |
abstract class ParallelPluginComponent extends PluginComponent { | |
import global._ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import scala.util.parsing.json._ | |
val prettyFormatter: JSONFormat.ValueFormatter = { | |
def create(level: Int): JSONFormat.ValueFormatter = (x: Any) => { | |
x match { | |
case s: String => "\"" + JSONFormat.quoteString(s) + "\"" | |
case jo: JSONObject => | |
"{\n" + | |
"\t" * (level + 1) + | |
jo.obj.map({ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Stream._ | |
/** A possibly finite stream that repeatedly applies a given function to a start value. | |
* | |
* @param start the start value of the stream | |
* @param f the function that's repeatedly applied | |
* @return the stream returning the possibly finite sequence of values `start, f(start), f(f(start)), ...` | |
*/ | |
def iterate[A](f: A => A, a: A): Stream[A] = unfold((x: A) => Some((x, f(x))), a) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Association Heterogeneous List | |
object AHListTest { | |
object AHList { | |
def apply[K]() = new AHNil[K]() | |
} | |
sealed trait AHList[K] { | |
def get[V : Manifest](k: K): Option[V] = None | |
def get[V : Manifest](k: K, default: V): V = get[V](k).getOrElse(default) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package application | |
import sindi._ | |
import service.a._ | |
import service.x.module._ | |
object AppContext extends Context { | |
override lazy val modules = new ServiceXModule :: Nil |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package object field { | |
case class Field[T]() | |
val name = Field[String]() | |
val age = Field[Int]() | |
val admin = Field[Boolean]() | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
############ | |
# QuickSBT # | |
############ | |
# Launch SBT with support for generating /tmp/sbt.quickfix file for Vim | |
# http://github.com/aloiscochard / https://gist.github.com/4698501 | |
# Error format for SBT, and shortcut to open SBT quickfix file : |
OlderNewer