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
blabl |
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
blabl |
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
jolie question |
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
val getLanguageFile = (__ \ "codeUrl").json.copyFrom( | |
(__ \ "files").json.pick[JsObject].map{ js => | |
js.fields.collectFirst{ case (k, v) if(v \ "language" != JsNull) => v \ "raw_url" }.get | |
} | |
) | |
val getQuestionFile = (__ \ "questionUrl").json.copyFrom( | |
(__ \ "files").json.pick[JsObject].map{ js => | |
js.fields.collectFirst{ case (k, v) if(v \ "language" == JsNull) => v \ "raw_url" }.get | |
} |
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
labalbala |
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
labalbala |
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
coucou c'est une question |
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
coucou c'est une question2 |
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
scala> import play.api.data.validation._ | |
scala> ((__ \ "field1").readNullable[String] and (__ \ "field2").readNullable[Int]).tupled.filter(ValidationError("unexpected result")){ case( Some(x), None ) => true; case ( None, Some(x) ) => true; case _ => false } | |
res18: play.api.libs.json.Reads[(Option[String], Option[Int])] = play.api.libs.json.Reads$$anon$8@10654cd8 | |
scala> Json.obj("field1" -> "toto").validate(res18) | |
res19: play.api.libs.json.JsResult[(Option[String], Option[Int])] = JsSuccess((Some(toto),None),) | |
scala> Json.obj("field2" -> 5).validate(res18) | |
res20: play.api.libs.json.JsResult[(Option[String], Option[Int])] = JsSuccess((None,Some(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
Class Rectangle | |
val rectWrites = ( | |
(__ \ 'width).write[Long] and | |
(__ \ 'height).write[Long] and | |
(__ \ 'x).write[Long] and | |
(__ \ 'y).write[Long] | |
)( (r: Rectangle) => (r.width, r.height, r.x, r.y) ) |