Advanced Object Oriented Programming in Scala
People often associate "Advanced" Scala with pure, monadic functional programming, and "Object Oriented" Scala with newbies fresh from a Java
| @ load.ivy("com.amazonaws" % "aws-java-sdk" % "1.10.+") | |
| :: loading settings :: url = jar:file:/Users/haoyi/amm!/org/apache/ivy/core/settings/ivysettings.xml | |
| :: resolving dependencies :: com.amazonaws#aws-java-sdk-caller;working | |
| confs: [default] | |
| found com.amazonaws#aws-java-sdk;1.10.41 in central | |
| [1.10.41] com.amazonaws#aws-java-sdk;1.10.+ | |
| found com.amazonaws#aws-java-sdk-support;1.10.41 in central | |
| found com.amazonaws#aws-java-sdk-core;1.10.41 in central | |
| found commons-logging#commons-logging;1.1.3 in central | |
| found org.apache.httpcomponents#httpclient;4.3.6 in central |
| 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( |
Advanced Object Oriented Programming in Scala
People often associate "Advanced" Scala with pure, monadic functional programming, and "Object Oriented" Scala with newbies fresh from a Java
| haoyi-mbp:test haoyi$ ~/amm | |
| Loading... | |
| Welcome to the Ammonite Repl 0.5.7 | |
| (Scala 2.11.8 Java 1.8.0_25) | |
| haoyi-test@ load.ivy("com.typesafe.play" %% "play" % "2.5.0") | |
| haoyi-test@ load.ivy("com.typesafe.play" %% "play-netty-server" % "2.5.0") | |
| haoyi-test@ import play.core.server._, play.api.routing.sird._, play.api.mvc._ | |
| import play.core.server._, play.api.routing.sird._, play.api.mvc._ |
| haoyi-mbp:test haoyi$ cat Server.scala | |
| load.ivy("com.typesafe.play" %% "play" % "2.5.0") | |
| load.ivy("com.typesafe.play" %% "play-netty-server" % "2.5.0") | |
| load.ivy("org.scalaj" %% "scalaj-http" % "2.2.1") | |
| @ | |
| import play.core.server._, play.api.routing.sird._, play.api.mvc._ | |
| // Workaround for #371 | |
| Thread.currentThread.setContextClassLoader(getClass.getClassLoader) | |
| val config = play.api.Configuration( |
| import java.io.File | |
| import org.jsoup.Jsoup | |
| import org.jsoup.nodes.Document | |
| import scala.io.Source | |
| import collection.mutable | |
| case class Decl(val index: Int, | |
| val cls: String, | |
| val name: String, |
| /** | |
| * Single-file play framework application! Make sure everything | |
| * works, as this is the test case that un-earthed #371 | |
| */ | |
| load.ivy("com.typesafe.play" %% "play" % "2.5.0") | |
| load.ivy("com.typesafe.play" %% "play-netty-server" % "2.5.0") | |
| load.ivy("org.scalaj" %% "scalaj-http" % "2.2.1") | |
| @ |
| import scalatags.Text.all._ | |
| import collection.mutable | |
| // http://flatuicolors.com/ | |
| val red = "#c0392b" | |
| val green = "#27ae60" | |
| val yellow = "#f39c12" | |
| val blue = "#2980b9" | |
| val magenta = "#8e44ad" | |
| val cyan = "#16a085" | |
| val black = "#000" |
| val x = 1 |
| /** | |
| * React v15.3.0 | |
| * | |
| * Copyright 2013-present, Facebook, Inc. | |
| * All rights reserved. | |
| * | |
| * This source code is licensed under the BSD-style license found in the | |
| * LICENSE file in the root directory of this source tree. An additional grant | |
| * of patent rights can be found in the PATENTS file in the same directory. | |
| * |