- 2014/07/13 Scalaz勉強会
- @gakuzzzz
- 中村 学
- 株式会社Tech to Value
- play2-auth が scala-awesomeに載りました
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 play.api.mvc._ | |
object Application extends Controller { | |
def upload = Action(parse.multipartFormData) { | |
request => | |
if (request.body.files.isEmpty) BadRequest("Invalid file!") | |
else if (request.body.asFormUrlEncoded.isEmpty) BadRequest("Invalid data!") | |
else Ok("Everything is okay!") |
@kuzuha よりネタ投下していただいたので、Scalaで実装してみた。
ネタ元: 裏サンデー | 寿司 虚空編 | 第1話
import scala.annotation.tailrec
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
import Ordering.Implicits._ | |
case class Version(name: String, numbers: (Int, Int, Int, Int)) extends AnyRef with Ordered[Version] { | |
def compare(other: Version) = if (numbers == other.numbers) 0 else if (numbers < other.numbers) -1 else 1 | |
} |
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
sealed trait IOOperation[A] { | |
def map[B](f: A => B): IOOperation[B] = | |
this match { | |
case PutChar(c, a) => | |
PutChar(c, f(a)) | |
case GetChar(g) => | |
GetChar(f compose g) | |
} | |
} | |
case class PutChar[A](c: Char, a: A) extends IOOperation[A] |
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
#プライベートリポジトリ用コンテナを起動 | |
docker run -d -p 5000:5000 samalba/docker-registry | |
#実験のために適当なコンテナを起動 | |
docker run -i -t -d --name cent01 centos /bin/bash | |
#起動したコンテナをコミットしてタグ付け | |
docker commit cent01 test1/centos | |
docker tag test1/centos 192.168.10.60:5000/centos_test |
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
(defn points [^BufferedImage image ^BufferedImage screen] | |
(let [width (.getWidth image) | |
height (.getHeight image) | |
xrange (range width) | |
yrange (range height)] | |
(for [points | |
(for [sx (range (- (.getWidth screen) width)) | |
sy (range (- (.getHeight screen) height))] | |
(for [tx xrange | |
ty yrange] |
The general guidelines to follow the Mediterranean diet that dietitians provided to participants included the following positive recommendations:
- abundant use of olive oil for cooking and dressing dishes;
- consumption of ≥ 2 daily servings of vegetables (at least one of them as fresh vegetables in a salad), discounting side dishes;
- ≥ 2-3 daily servings of fresh fruits (including natural juices)
- ≥ 3 weekly servings of legumes;
- ≥ 3 weekly servings of fish or seafood (at least one serving of fatty fish);
- ≥ 1 weekly serving of nuts or seeds;
- select white meats (poultry without skin or rabbit) instead of red meats or processed meats (burgers, sausages);
金曜日、私は Heroku から Amazon Web Services(AWS) を直接使うように Soundslice を移行しました。私はこの変更ができてとても、そうとても嬉しくて、私がどうやったかということと、もし皆さんが同じような立場だったら何故それを検討すべきかということについて広く伝えたいと思います。