Skip to content

Instantly share code, notes, and snippets.

View eed3si9n's full-sized avatar

eugene yokota eed3si9n

View GitHub Profile
@eed3si9n
eed3si9n / xmlprotocol.scala
Created November 17, 2011 02:36
xml protocol generated by general test
// Generated by <a href="http://scalaxb.org/">scalaxb</a>.
package general
/**
usage:
val obj = scalaxb.fromXML[general.Foo](node)
val document = scalaxb.toXML[general.Foo](obj, "foo", general.defaultScope)
**/
object `package` extends XMLProtocol { }
@eed3si9n
eed3si9n / source-dep.sbt
Created December 31, 2011 20:30
displays internal source deps
TaskKey[Unit]("source-dep") <<= (fullClasspath in Runtime) map { (cp) =>
cp map { dir =>
val analysis = Defaults.extractAnalysis(dir)._2
analysis.relations.allSources map { file =>
println(file.getName.toString + " depends on " + analysis.relations.internalSrcDeps(file))
}
}
()
}
@eed3si9n
eed3si9n / Main.scala
Created February 14, 2012 09:47 — forked from xuwei-k/Main.scala
generate specs2 DataTables using treehugger
object Main extends App {
import treehugger.forest._
import definitions._
import treehuggerDSL._
val n = 10
object sym {
val nList = (1 to n).toList
val TableHeader = RootClass.newClass("TableHeader")
@eed3si9n
eed3si9n / go.scala
Created February 14, 2012 20:11 — forked from afternoon/go.xsd
XML Schema for Go Feeds API
// Generated by <a href="http://scalaxb.org/">scalaxb</a>.
package go
case class Pipelines(link: go.Link,
pipeline: go.Pipeline)
case class Job(jobsequence1: Option[go.JobSequence1] = None,
href: Option[java.net.URI] = None,
object Test {
def main(args: Array[String]): Unit = {
abstract class Transformer {
def transform(tree: Transformable): Transformable = tree match {
case Class(name, body) => Class(transformName(name), body map {transform(_).asInstanceOf[Statement]})
case VariableWrite(id, value) => VariableWrite(transformName(id), transform(value).asInstanceOf[Expression])
case Return(expr) => Return(transform(expr).asInstanceOf[Expression])
case VariableAccess(id) => VariableAccess(transformName(id))
case Value(value) => Value(transformValue(value))
<?xml version='1.0' encoding='UTF-8'?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0">
<modelVersion>4.0.0</modelVersion>
<groupId>com.eed3si9n</groupId>
<artifactId>sbt-appengine</artifactId>
<packaging>jar</packaging>
<description>sbt plugin to deploy on appengine</description>
<version>0.3.2-SNAPSHOT</version>
<licenses>
<license>
@eed3si9n
eed3si9n / build.scala
Created March 1, 2012 05:13
Using scalaxb within multiple configs
import sbt._
object Builds extends Build {
import sbtscalaxb.Plugin._
import ScalaxbKeys._
val Xsd = config("xsd") extend(Compile)
val Wsdl = config("wsdl") extend(Compile)
val Soap11 = config("soap11") extend(Compile)
val Soap12 = config("soap12") extend(Compile)
#!/usr/bin/ruby
# jsmin.rb 2007-07-20
# Author: Uladzislau Latynski
# This work is a translation from C to Ruby of jsmin.c published by
# Douglas Crockford. Permission is hereby granted to use the Ruby
# version under the same conditions as the jsmin.c on which it is
# based.
#
# /* jsmin.c
# 2003-04-21
import sbt._
import Keys._
import PlayProject._
import sbtbuildinfo.Plugin._
object ApplicationBuild extends Build {
val appName = "play-sbt-buildinfo-sample"
val appVersion = "1.0-SNAPSHOT"
@eed3si9n
eed3si9n / kind.scala
Created September 3, 2012 16:40
calculates a type's kind
// requires Scala 2.10.0-M7
def kind[A: scala.reflect.TypeTag]: String = {
import scala.reflect.runtime.universe._
def typeKind(sig: Type): String = sig match {
case PolyType(params, resultType) =>
(params map { p =>
typeKind(p.typeSignature) match {
case "*" => "*"
case s => "(" + s + ")"
}