This file contains hidden or 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 A | |
class A2 extends A | |
class B | |
trait M[X] | |
// | |
// Upper Type Bound | |
// | |
def upperTypeBound[AA <: A](x: AA): A = x |
This file contains hidden or 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
/* | |
* Copyright Christopher Schmidt 2010 | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software |
This file contains hidden or 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 BuildInfo { | |
lazy val settings = sourceGenerators in Test <+= (streams, sourceManaged in Test, baseDirectory) map emitBuildInfo | |
def emitBuildInfo(logger: TaskStreams, outputDir: File, baseDir: File): Seq[File] = { | |
val outputFile = outputDir / "BuildInfo.scala" | |
logger.log.info(s"Generating build info file at: ${outputFile}") | |
IO.write(outputFile, | |
s""" |
This file contains hidden or 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
/* | |
Thx to Albert Latacz for passing this on to me | |
Think its more or less a direct lift from the Artima Programming in Scala book, chapter 33 | |
at http://booksites.artima.com/programming_in_scala_2ed/examples/html/ch33.html | |
*/ | |
import java.io.InputStreamReader | |
import pure.commons.store.FileUtils | |
import scala.util.parsing.combinator._ | |
import scala.util.parsing.input.StreamReader |
This file contains hidden or 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 dispatch.classic./\ | |
import dispatch.classic.mime.Mime.MimeRequestTerms | |
val multipart = new MimeRequestTerms(/\) <<*("counterparty-file", anyString(), bytes) | |
val byteStream = new ByteArrayOutputStream() | |
multipart.body.get.writeTo(byteStream) | |
Request(url, RequestMethods.POST, | |
Map(HttpHeaders.ContentType.value -> multipart.body.get.getContentType.getValue), | |
byteStream.toByteArray) |
This file contains hidden or 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 gotchas | |
object NoArgMethods { | |
val l = List(1, 2, 3) | |
val correct = l.toSet // has type Set[Int] | |
val wrong = l.toSet() // has type Boolean | |
// toSet() is converted to toSet.apply() |
NewerOlder