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
//This is my general purpose client for the Javascript side | |
class AutowireClientAjax(val url: String)(implicit val ec: ExecutionContext = JSExecutionContext.queue) | |
extends SerAutowireClient { | |
override def doCall(req: Request): Future[Any] = { | |
val r = AutowireHelp.ClientSideReq.fromAutowire(req) | |
Ajax.post( | |
url = url, | |
data = r.toJsonCompact() | |
).map(_.responseText) |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<module type="JAVA_MODULE" version="4"> | |
<component name="FacetManager"> | |
<facet type="scala" name="Scala"> | |
<configuration> | |
<option name="basePackage" value="cgta.oscala" /> | |
<option name="compilerLibraryLevel" value="Project" /> | |
<option name="compilerLibraryName" value="SBT: scala:2.11.4" /> | |
<option name="compilerOptions" value="-feature -language:implicitConversions -language:higherKinds -language:existentials -language:postfixOps -Xfatal-warnings" /> | |
<option name="deprecationWarnings" value="true" /> |
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
object | { | |
implicit def t1ToU2[T](x: T): T | Nothing = x.asInstanceOf[T | Nothing] | |
implicit def t2ToU2[T](x: T): Nothing | T = x.asInstanceOf[Nothing | T] | |
implicit def t1ToU3[T](x: T): T | Nothing | Nothing = x.asInstanceOf[T | Nothing | Nothing] | |
implicit def t2ToU3[T](x: T): Nothing | T | Nothing = x.asInstanceOf[Nothing | T | Nothing] | |
implicit def t1ToU4[T](x: T): T | Nothing | Nothing | Nothing = x.asInstanceOf[T | Nothing | Nothing | Nothing] | |
implicit def t2ToU4[T](x: T): Nothing | T | Nothing | Nothing = x.asInstanceOf[Nothing | T | Nothing | Nothing] | |
} |
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.lang.ref.SoftReference | |
object CSoftRef { | |
def apply[A](blk : => A) = new CSoftRef[A](blk) | |
} | |
class CSoftRef[A](blk : => A) extends MagicMixin { | |
private var ref = new SoftReference[A](blk) | |
def get : A = { | |
ref.get match { |
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
/** Class for testing the distribution of hashCodes for Products/Collections of items in Scala. | |
* Should be able to just copy - paste this right into the scala interpreter | |
*/ | |
object Hashable { | |
val HashSeed = 0x27d4eb2d | |
val HashConstant = 41 | |
val NullHashCode = 0 | |
/** | |
* Adapted from |
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
trait CEnum { | |
/** The concrete subtype of EnumElements | |
*/ | |
type ET <: EnumElement | |
/** | |
* Override this trait in your subclass with the | |
* base type of the EnumElements, then set ET = to that value | |
* the Template type in Ordered might need to be ET | |
* to ensure proper type safety, however I was getting |
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
diff --git a/src/main/scala/sbt/Compile.scala b/src/main/scala/sbt/Compile.scala | |
index aaaab2d..21f5ef6 100644 | |
--- a/src/main/scala/sbt/Compile.scala | |
+++ b/src/main/scala/sbt/Compile.scala | |
@@ -261,9 +261,28 @@ final class LoggerReporter(maximumErrors: Int, log: Logger) extends scala.tools. | |
case NoPosition => log.log(level, msg) | |
case FakePos(fmsg) => log.log(level, fmsg+" "+msg) | |
case _ => | |
- val sourcePrefix = pos.source.map(_.file.path).getOrElse("") | |
- val lineNumberString = pos.line.map(line => ":" + line + ":").getOrElse(":") + " " |
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
Squeryl/src/main/scala/org/squeryl/dsl/QueryDsl.scala:210: type mismatch; | |
found : org.squeryl.Query[org.squeryl.dsl.Measures[QueryDsl.this.LongType]] | |
required: org.squeryl.Query[QueryDsl.this.LongType] | |
Note that implicit conversions are not applicable because they are ambiguous: | |
both method singleColComputeQuery2ScalarQuery in trait QueryDsl of type [T](org.squeryl.Query[org.squeryl.dsl.Measures[T]])QueryDsl.this.ScalarQuery[T] | |
and method singleColComputeQuery2Scalar in trait QueryDsl of type [T](org.squeryl.Query[org.squeryl.dsl.Measures[T]])T | |
are possible conversion functions from org.squeryl.Query[org.squeryl.dsl.Measures[QueryDsl.this.LongType]] to org.squeryl.Query[QueryDsl.this.LongType] | |
def forUpdate = _inner.forUpdate | |
^ | |
Squeryl/src/main/scala/org/squeryl/dsl/QueryDsl.scala:224: type mismatch; |
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
class Settings extends Record { | |
import Dsl._ | |
val maxQty = req("maxQty", 1, IntTransformer).ensuring{v=> v >=! 0} | |
//Alternate version | |
val maxQty = req("maxQty", 1, IntTransformer).ensuring(>=!0).ensuring(!==!666) | |
val minQty = opt(req("minQty", 2, IntTransformer).ensuring(>=!0)) | |
override def check : Option[ErrorMsg] = { | |
maxQty.value >=! minQty.value |
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
//Supposing we have this a list of arbs of this form perhaps in a lib ArbFunc | |
object ArbFunc { | |
//... | |
def apply[T1, T2, T3, T4, R](f: (T1, T2, T3, T4) => R)(implicit a: Arbitrary[(T1, T2, T3, T4)]): Arbitrary[R] = | |
Arbitrary {for (t <- Arbitrary.arbitrary[(T1, T2, T3, T4)]) yield f(t._1, t._2, t._3, t._4)} | |
//... | |
} | |
//Given this case class | |
case class Point(label : String, x : Int, y : Int, z : Int) |