%title: %author: Takuya Fujimura (@tlync) %date: 2014-10-16
人を恨むな仕組みを恨め
#!/bin/sh | |
commits=`git log @{u}..` | |
if [ -z "$commits" ]; then | |
exit 0 | |
fi | |
COLOR_MAIN="\x1B[01;91m" | |
COLOR_SUB="\x1B[01;90m" | |
COLOR_PASS="\x1B[32m" |
%title: %author: Takuya Fujimura (@tlync) %date: 2014-10-16
人を恨むな仕組みを恨め
#!/bin/sh | |
CMD="sbt test" # Command that runs your tests | |
# Check if we actually have commits to push | |
#commits=`git log @{u}..` | |
#if [ -z "$commits" ]; then | |
# exit 0 | |
#fi | |
echo | |
read -p "…もちろん、ちゃんとテストしたよな?" -n 0 -r < /dev/tty |
<configuration> | |
<conversionRule conversionWord="coloredLevel" converterClass="play.api.Logger$ColoredLevel" /> | |
<!-- console --> | |
<appender name="STDOUT1" class="ch.qos.logback.core.ConsoleAppender"> | |
<encoder> | |
<pattern>%coloredLevel %gray%date{HH:mm:ss.SSS} [%gray(%thread)] - %replace(%replace(%message){'\n','\\n'}){'\t',' '}, %replace(%replace(%xException{5}){'\n','\\n'}){'\t',' '}%n%nopex</pattern> | |
</encoder> | |
</appender> |
// Transparent IO Context pattern using implicit parameter | |
// --- | |
// domain | |
// --- | |
// base (サンプルなのでほぼただの Marker Trait) | |
trait Entity | |
// 永続化に利用するセッションを保持するただのコンテナ |
// base (サンプルなのでただの marker trait) | |
trait Entity | |
trait Repository | |
// domain layer | |
case class User(id: Int, name: String) extends Entity | |
trait Users extends Repository { | |
def find(id: Int): Option[User] | |
} |
// domain layer | |
trait Entity | |
trait Repo | |
case class Context[T](session: T) | |
trait TransparentContext[T] { | |
implicit def c2s(implicit ctx: Context[T]) = ctx.session | |
implicit def s2c(implicit session: T) = Context(session) | |
} |
// dummy session classes for sample codes | |
final class AnormSession { | |
def anormMethod = { | |
println("anorm") | |
} | |
def start = {} | |
def commit = {} | |
} |
// dummy session classes for sample codes | |
final class AnormSession { | |
def anormMethod = { | |
println("anorm") | |
} | |
def start = {} | |
def commit = {} | |
} |
import play.api.libs.json._ | |
import play.api.libs.functional.syntax._ | |
object Main { | |
implicit val jsonFormat = | |
(__ \ "v").write[String].contramap((fb: FizzBuzz) => fb.v) | |
def main(args: Array[String]) { | |
print(Json.toJson(FizzBuzz.Fizz)) | |
print(Json.toJson(FizzBuzz.Buzz)) |