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
package controllers | |
import javax.inject._ | |
import play.api._ | |
import play.api.mvc._ | |
@Singleton | |
class DiaryController @Inject() extends Controller { | |
def index = Action { |
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
name := """sword""" | |
version := "1.0-SNAPSHOT" | |
lazy val root = (project in file(".")).enablePlugins(PlayScala) | |
scalaVersion := "2.11.8" | |
routesGenerator := InjectedRoutesGenerator |
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
package models | |
import java.sql.Timestamp | |
import java.text.SimpleDateFormat | |
import javax.inject.Inject | |
import play.api.Logger | |
import play.api.db.slick.DatabaseConfigProvider | |
import slick.driver.JdbcProfile |
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
package chapter13 | |
import java.io.BufferedReader | |
import scala.collection.mutable.ListBuffer | |
case class Person(val first:String, val valid:Boolean, age: Int) | |
/** | |
* Refactoring examples. |
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
package chapter10 | |
import java.util.Date | |
/** | |
* Internal DSL example | |
*/ | |
object TimeHelpers { | |
implicit def longToTimeSpanBuilder(in: Long): TimeSpanBuilder = TimeSpanBuilder(in) |
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
package chapter8 | |
/** | |
* Created by hoshi on 1/26/16. | |
*/ | |
object Helper { | |
implicit class Greeting(val x: Int) { | |
def greet = "Hello " + x | |
} | |
} |
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
package chapter8 | |
/** | |
* Created by hoshi on 1/25/16. | |
*/ | |
object TypeSystem { | |
def test(int: AnyVal) = () | |
def main(args: Array[String]) { | |
test(5) |
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
package chapter7 | |
/** | |
* Created by hoshi on 1/25/16. | |
*/ | |
abstract class LivingThing | |
abstract class Plant extends LivingThing | |
abstract class Fungus extends LivingThing |
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
package chapter6 | |
/** | |
* Created by hoshi on 1/25/16. | |
*/ | |
object RangeMain { | |
def main(args: Array[String]) { | |
// Range | |
println(1 to 10) | |
println(1 until 10) |
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
package chapter6 | |
/** | |
* Created by hoshi on 1/22/16. | |
*/ | |
object Collection { | |
def main(args: Array[String]) { | |
def pri(x:Any): Unit = println(x + " " + x.getClass.getName) | |
// While the collection.immutable package is automatically added to the current namecepace in Scala, the collection.mutable is not. |
NewerOlder