This file contains hidden or 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
| -gem "redcarpet" | |
| +#gem "redcarpet" |
This file contains hidden or 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
| FROM debian:7.4 | |
| MAINTAINER mather <[email protected]> | |
| RUN apt-get update | |
| # SSH Server | |
| RUN apt-get install -y openssh-server sudo | |
| RUN mkdir /var/run/sshd | |
| RUN echo 'root:root' | chpasswd |
This file contains hidden or 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
| # -*- coding: utf-8 -*- | |
| from fabric.api import * | |
| from yaml_loader import load_env_from_yaml | |
| load_env_from_yaml('env.yaml', globals()) | |
This file contains hidden or 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 org.apache.commons.daemon.{Daemon, DaemonContext} | |
| class ApplicationDaemon(appName: String) extends Daemon { | |
| private[this] val actorSystem = ActorSystem(appName) | |
| override def init(context: DaemonContext) {} | |
| override def destroy {} | |
| override def start { |
This file contains hidden or 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
| trait DatabaseComponent { this: Profile => | |
| def database: profile.simple.Database | |
| } | |
| // テスト時 | |
| trait H2DatabaseComponent extends DatabaseComponent { | |
| import profile.simple._ | |
| def database = Database.forURL("jdbc:h2:mem:test") | |
| } |
This file contains hidden or 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 akka.actor.{ExtendedActorSystem, Extension, ExtensionId} | |
| class SampleExtentionImpl(system: ExtendedActorSystem) extends Extension { | |
| val hoge = "HOGE" | |
| } | |
| object SampleExtension extends ExtensionId[SampleExtensionImpl] { | |
| def createExtension(system: ExtendedActorSystem) = new SampleExtensionImpl(system) | |
| } |
This file contains hidden or 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
| FROM debian:latest | |
| MAINTAINER mather <[email protected]> | |
| RUN apt-get update | |
| RUN apt-get autoremove -y | |
| RUN apt-get install -y wget openjdk-7-jre | |
| RUN wget http://downloads.typesafe.com/scala/2.11.1/scala-2.11.1.deb | |
| RUN dpkg -i scala-2.11.1.deb |
This file contains hidden or 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
| trait SampleParsers extends RegexParsers { | |
| /** 文字列に".i"を付けると大文字小文字を区別せずマッチさせるようにする拡張 */ | |
| implicit class IgnoreCaseString(s: String) { | |
| def i: Parser[String] = ("""(?i)\Q""" + s + """\E""").r | |
| } | |
| def keyword: Parser[String] = "keyword:".i | |
| def value: Parser[String] = "[a-zA-Z0-9]+".r | |
| def parameter: Parser[(String,String)] = keyword ~ value ^^ { case k~v => (k,v) } | |
| } |
This file contains hidden or 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 java.io._ | |
| import java.lang.Math | |
| import scala.annotation.tailrec | |
| /** | |
| * ref: http://justindomke.wordpress.com/2008/11/29/mandelbrot-in-scala/ | |
| */ | |
| object mandelbrot { | |
| // tiny complex number class including syntactic sugar for basic operations |
This file contains hidden or 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 scala.reflect.ClassTag | |
| object Hoge { | |
| def main(args: Array[String]) = { | |
| val s = new Hoge[StringSample] | |
| val i = new Hoge[IntSample] | |
| s.detectType(StringSample("hogehoge")) //=> detected! | |
| s.detectType(IntSample(1)) | |
| i.detectType(StringSample("hogehoge")) | |
| i.detectType(IntSample(2)) //=> detected! |