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
miles@frege:~$ scala | |
Welcome to Scala version 2.11.0 (Java HotSpot(TM) 64-Bit Server VM, Java 1.7.0_55). | |
Type in expressions to have them evaluated. | |
Type :help for more information. | |
scala> import scala.language.dynamics | |
import scala.language.dynamics | |
scala> case class Assoc[K, V](value: V) | |
defined class Assoc |
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 com.felstar.macros.timestamp | |
import scala.reflect.macros.blackbox.Context | |
import scala.language.experimental.macros | |
object TimestampMacro { | |
def timestampString: String = macro timestampMacro | |
def timestampMacro(c: Context): c.Tree = { | |
import c.universe._ |
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
def initialiseApp[T<:LifeCycle](port: Int) = { | |
val server = new Server(port) | |
val context = new WebAppContext() | |
context.setContextPath("/") | |
context.setResourceBase(new File(getClass.getResource("/webresources/index.html").getFile).getCanonicalFile.getParentFile.getCanonicalPath) | |
context.addEventListener(new ScalatraListener) | |
context.addServlet(classOf[DefaultServlet], "/") | |
context.setInitParameter(ScalatraListener.LifeCycleKey, classOf[ConfiguredBootstrap].getCanonicalName) | |
context.setAttribute(WebInfConfiguration.WEBINF_JAR_PATTERN, ".*\\.jar$") |
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
myfine.domain.user.actor.handlers.BetterAnonymousClassApp$$anon$1(mutingStuff = let's see, otherStuff = List(works, too), stuff = works, moreLazyStuff = myfine.domain.user.actor.handlers.BetterAnonymousClassApp$$anon$1$$anon$2(extensionData = This is just some extension data)) | |
Disconnected from the target VM, address: '127.0.0.1:55780', transport: 'socket' | |
{ | |
"mutingStuff" : "let's see", | |
"otherStuff" : [ "works, too" ], | |
"stuff" : "works", | |
"moreLazyStuff" : { | |
"extensionData" : "This is just some extension data" | |
} | |
} |
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 scala.pickling._ | |
import scala.reflect.runtime.universe._ | |
import scala.util.parsing.json._ | |
import scala.collection.mutable.{StringBuilder, Stack} | |
package object edn { | |
implicit val pickleFormat: EdnPickleFormat = new EdnPickleFormat | |
} |
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 com.felstar.playpen.scalaxb | |
import java.io.File | |
object PostProcessScalaxb { | |
def allFiles(path:File):List[File]= { | |
val (dirs,files)=path.listFiles.toList.partition(_.isDirectory) | |
files ::: dirs.flatMap(allFiles) | |
} |
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
haoyi-mbp:Ammonite haoyi$ ~/amm | |
Loading... | |
Welcome to the Ammonite Repl 0.5.2 | |
(Scala 2.11.7 Java 1.8.0_25) | |
haoyi-Ammonite@ load.ivy("org.scalaj" %% "scalaj-http" % "2.2.0") | |
haoyi-Ammonite@ import ammonite.ops._, scalaj.http._ | |
import ammonite.ops._, scalaj.http._ | |
haoyi-Ammonite@ Http("https://api.github.com/repos/scala/scala").asString | |
res2: HttpResponse[String] = HttpResponse( |
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 com.scalawilliam.example.play | |
import play.api.libs.ws._ | |
/** | |
* Play's Scala WS library is very very cool. Provides you with plenty niceties. | |
* See more: https://www.playframework.com/documentation/2.3.x/ScalaWS | |
* | |
* Unfortunately it by default requires a Play application context. | |
* But you do not necessarily always want that. |
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
public class CreateContainer { | |
public static void main(String[] args) throws IOException { | |
FileInputStream in = new FileInputStream("C:/temp/SampleData.xls"); | |
POIFSFileSystem fileSystem = new POIFSFileSystem(in); | |
HSSFWorkbook workBook = new HSSFWorkbook(fileSystem); | |
HSSFSheet sheet = workBook.getSheetAt(0); | |
List<String> propertyNames = Collections.emptyList(); | |
IndexedContainer c = new IndexedContainer(); | |
for (Row row : sheet) { | |
int rowIndex = row.getRowNum(); |
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
match (a {name:"Daniel"}), (b {name:"Jerry"}) | |
with a,b | |
match s = shortestPath(a-[]-b) | |
unwind nodes(s) as n | |
with collect(n) as m | |
return head(m) |
OlderNewer