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 java.util.regex.Pattern | |
| import play.core.Routes | |
| import play.api.mvc._ | |
| object Router extends Routes { | |
| def routes = { | |
| // Static paths | |
| case Route("GET", p"") => controllers.Application.index | |
| case Route("GET", p"/items") => controllers.Items.list |
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
| case class Node(value: Int, next: Option[Node]) | |
| def reverse(node: Node, prev: Option[Node] = None): Node = { | |
| val reversed = node.copy(next = prev) | |
| node.next map {reverse(_, Some(reversed))} getOrElse reversed | |
| } | |
| /****************************************************************/ | |
| val one = Node(1,Some(Node(2,Some(Node(3,None))))) | |
| println(s"$one\n${reverse(one)}") |
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
| function *fibonacci(n) { | |
| const infinite = !n && n !== 0; | |
| let current = 0; | |
| let next = 1; | |
| while (infinite || n--) { | |
| yield current; | |
| [current, next] = [next, current + next]; | |
| } | |
| } |
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 org.cakesolutions.spark | |
| import org.apache.spark.SparkConf | |
| import org.apache.spark.api.java.JavaSparkContext | |
| import scala.Tuple2 | |
| fun main(args: Array<String>) { | |
| val inputFile = args[0] | |
| val outputFile = args[1] |
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
| Infos générales et saines lectures | |
| - les 4 articles Strategic Scala Style du blog de lee haoyi | |
| http://www.lihaoyi.com/post/StrategicScalaStylePrincipleofLeastPower.html | |
| http://www.lihaoyi.com/post/StrategicScalaStyleConcisenessNames.html | |
| http://www.lihaoyi.com/post/StrategicScalaStylePracticalTypeSafety.html | |
| http://www.lihaoyi.com/post/StrategicScalaStyleDesigningDatatypes.html | |
| Et la track de Daniel westheide | |
| http://danielwestheide.com/scala/neophytes.html | |
| Pour te familiariser avec le langage lui même tu peux pratiquer avec les workshops |
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
| trait Functor[Box[_]] { | |
| def map[In, Out](boxA: Box[In])(f: In => Out): Box[Out] | |
| } | |
| object Functor { | |
| implicit val functorOption = new Functor[Option] { | |
| override def map[In, Out](boxA: Option[In])(f: In => Out) = boxA.map(f) | |
| } | |
| implicit val functorList = new Functor[List] { |
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
| const config = { | |
| typeDirs: [ | |
| { type: "pdf", directory: "documents" }, | |
| { type: "png", directory: "images" }, | |
| { type: "mp3", directory: "music" }, | |
| ], | |
| }; | |
| type Config = typeof config; | |
| type TypeDirs = Config["typeDirs"]; |
OlderNewer