Skip to content

Instantly share code, notes, and snippets.

View kmizu's full-sized avatar

Kota Mizushima kmizu

View GitHub Profile
@gakuzzzz
gakuzzzz / gist:8d497609012863b3ea50
Last active January 12, 2021 12:50
Scalaz勉強会 主要な型クラスの紹介
@emrecelikten
emrecelikten / Application.scala
Last active February 9, 2017 12:47
Sample upload testing in Play Framework 2.3.1
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!")
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
}
@tonymorris
tonymorris / IO.scala
Created November 5, 2013 23:57
Pure-functional IO in Scala
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]
@hagix9
hagix9 / gist:7287649
Last active February 23, 2017 20:30
Dockerでプライベートリポジトリを使う
#プライベートリポジトリ用コンテナを起動
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
@Shinpeim
Shinpeim / 00.md
Last active January 16, 2020 13:08
Scala 入学式の資料

Better Java としての Scala

Hello World

  • src/main/scala/Main.scala
object Main {
  def main(args: Array[String]): Unit = {
    println("hello scala!")
(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]
@eed3si9n
eed3si9n / Mediterranean-Diet.md
Last active December 20, 2015 01:48
Primary Prevention of Cardiovascular Disease with a Mediterranean Diet http://www.nejm.org/doi/suppl/10.1056/NEJMoa1200303/suppl_file/nejmoa1200303_appendix.pdf

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);
@Gab-km
Gab-km / whyILeftHeroku.rst
Last active December 30, 2022 10:56
何故私は Heroku から離れたか、および新しい AWS セットアップのメモ

何故私は Heroku から離れたか、および新しい AWS セットアップのメモ

原著者

Adrian Holovaty

原文

Why I left Heroku, and notes on my new AWS setup

金曜日、私は Heroku から Amazon Web Services(AWS) を直接使うように Soundslice を移行しました。私はこの変更ができてとても、そうとても嬉しくて、私がどうやったかということと、もし皆さんが同じような立場だったら何故それを検討すべきかということについて広く伝えたいと思います。