Skip to content

Instantly share code, notes, and snippets.

Hello World
@ssmylh
ssmylh / Console.scala
Created September 8, 2015 13:55
Implement Console of FP in Scala using Scalaz v7.2.0-M3
import scalaz._
import scalaz.Free._
import scalaz.std.function._
import scalaz.{ Free, ~> }
sealed trait Console[A]
case object ReadLine extends Console[Option[String]]
case class PrintLine(line: String) extends Console[Unit]
object Console {
@ssmylh
ssmylh / MutationObserver.html
Created March 8, 2015 01:54
Mutation Observer
<!doctype html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<title>MutationObserver Sample</title>
<script>
/* https://developer.mozilla.org/ja/docs/Web/API/MutationObserver */
document.addEventListener('DOMContentLoaded', start);
function start() {
@ssmylh
ssmylh / provision_docker_for_trusty64.sh
Last active August 29, 2015 14:15
Provision Docker in Vagrant - Ubuntu Trusty 64bit
#!/usr/bin/env bash
echo "Installing docker ..."
sudo apt-get update >/dev/null 2>&1
sudo apt-get install -y docker.io >/dev/null 2>&1
source /etc/bash_completion.d/docker.io
echo "Updating docker ..."
@ssmylh
ssmylh / section6.txt
Created December 11, 2011 04:59
http://unfiltered.databinder.net/Unfiltered.html の第6章~9章の自分的訳メモ(ver 0.5.1)
『Matching and Responding』
典型的なリクエスト/レスポンスが数行で手近に扱えます。
この項ではシンプルなkey-valueストアを示すために、パターンマッチングとコンビネータ関数を適用します。
■6.a Request Matchers
○Methods and Paths
UnfilteredはパスセグメントからHTTPメソッドとHTTPヘッダに、広い範囲の“request matchers” - リクエストに対して働く抽出子オブジェクト - を、
供給します。
@ssmylh
ssmylh / build.sbt
Created November 23, 2011 15:36
Unfiltered - Netty giter8テンプレートのbuild.sbt
organization := "com.example"
name := "unfiltered_netty_sample"
scalaVersion := "2.9.1"
version := "0.1.0-SNAPSHOT"
libraryDependencies ++= Seq(
"net.databinder" %% "unfiltered-netty-server" % "0.5.1",
@ssmylh
ssmylh / build.sbt
Created November 12, 2011 09:27
Unfiltered - giter8テンプレートのbuild.sbt
organization := "com.example"
name := "unfiltered-sample"
scalaVersion := "2.9.1"
version := "0.1.0-SNAPSHOT"
libraryDependencies ++= Seq(
"net.databinder" %% "unfiltered-filter" % "0.6.1",