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
#!/bin/sh | |
exec scala "$0" "$@" | |
!# | |
val helpMessage = """ | |
Usage: | |
-n do not output the trailing newline | |
-x repeat x times |
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
-- http://stackoverflow.com/questions/1124603/grouped-limit-in-postgresql-show-the-first-n-rows-for-each-group | |
-- http://www.postgresql.jp/document/9.2/html/tutorial-window.html | |
CREATE TABLE empsalary ( | |
depname varchar(10) not null | |
, empno integer not null | |
, salary integer not null | |
); | |
INSERT INTO empsalary (depname, empno, salary) VALUES ('develop', 11, 5200); |
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 com.example | |
import org.slf4j.LoggerFactory | |
trait BaseLogger { | |
private val classNameLogger = LoggerFactory.getLogger(classOf[BaseLogger]) | |
private val thisLogger = LoggerFactory.getLogger(this.getClass) |
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 sbt._ | |
import Keys._ | |
/** | |
* テストをいい感じに分割して実行します。 | |
* 分割にはテストクラス名のCRC32チェックサムを使っています。 | |
* 例えば3分割したい時は | |
* | |
* > sbt 'splitTest 3 1' | |
* > sbt 'splitTest 3 2' |
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 com.example | |
import shapeless._ | |
import shapeless.labelled.FieldType | |
trait Show[A] { | |
def show(a: A): String | |
} | |
object Show { |
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
scala> import scala.collection.immutable.SortedSet | |
import scala.collection.immutable.SortedSet | |
scala> case class Hoge(i: Int) | |
defined class Hoge | |
scala> SortedSet(1, 2, 3, 4, 5) | |
res0: scala.collection.immutable.SortedSet[Int] = TreeSet(1, 2, 3, 4, 5) | |
scala> SortedSet(1, 2, 3, 4, 5).map(Hoge.apply) |
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 com.example | |
import java.time.LocalDateTime | |
@ToString | |
case class UserName( | |
firs: String, | |
last: String | |
) |
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 scalaz._ | |
import Scalaz._ | |
import scala.util.parsing.combinator._ | |
object KanjiNumberParser extends RegexParsers { | |
def one = "一" ^^ { _ => 1L } | |
def two = "二" ^^ { _ => 2L } | |
def three = "三" ^^ { _ => 3L } | |
def four = "四" ^^ { _ => 4L } | |
def five = "五" ^^ { _ => 5L } |
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
#!/bin/bash | |
dir=${1:?directory is not specified} | |
subproject=$2 | |
cd $dir | |
tmpfile=$(mktemp "project/$$.sbt") | |
clean() { | |
rm -f $tmpfile |
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 models | |
import javax.inject.{Inject, Provider, Singleton} | |
import play.api.inject.{ApplicationLifecycle, Binding, Module} | |
import play.api.{Configuration, Environment, Logger} | |
import scalikejdbc.config.TypesafeConfigReader | |
import scalikejdbc.{Commons2ConnectionPoolFactory, ConnectionPool} | |
import scala.concurrent.{ExecutionContext, Future} |
NewerOlder