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
val q = (for { | |
b <- Build if b.account === account && b.start_time > som && b.start_time < eom | |
} yield b).groupBy(_.instance_size).map { | |
case (a, q) => (a, q.map(_.minutes).sum) | |
} |
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 controllers | |
import play.api.mvc.Action | |
import play.api.mvc.Controller | |
import play.api.mvc.AsyncResult | |
import views.html.index | |
import play.api.libs.openid.OpenID | |
import play.api.libs.concurrent.Redeemed | |
import play.api.libs.concurrent.Thrown | |
import play.api._ |
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
implicit val PromiseInstance = new Monad[Promise] { | |
def point[A](a: => A) = Promise.pure(a) | |
def bind[A, B](fa: Promise[A])(f: A => Promise[B]) = fa.flatMap(f) | |
} |
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
def forMonth(account: String, month: Timestamp) = { | |
val eom = add30Days(month) | |
for { | |
b <- Build if b.account === account && b.start_time > month && b.start_time < eom | |
} yield b | |
} |
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
if ( cond ) { | |
if (cond) { | |
"a" | |
} else { | |
"b" | |
} | |
} else if (cond) { | |
"c" | |
} else { | |
if (cond) { |
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
[info] bar.json (2.0B) | |
[info] smart 0.2 ms | |
[info] jackson 1.6 ms | |
[info] jawn 0.6 ms | |
[info] bla2.json (41.9K) | |
[info] smart 6.4 ms | |
[info] jackson 13.8 ms | |
[info] jawn 12.8 ms | |
[info] bla25.json (1.8M) | |
[info] smart 117.2 ms |
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
val stuff = "stuff" + someString match { | |
case "" => "" | |
case s => " " + s | |
} |
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
<configuration> | |
<conversionRule conversionWord="coloredLevel" converterClass="play.api.Logger$ColoredLevel" /> | |
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> | |
<encoder> | |
<pattern>%date - [%level] - from %logger in %thread %n%message%n%xException%n</pattern> | |
</encoder> | |
</appender> |
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
for { | |
a <- Option("stuff") | |
b <- doStuff(a) | |
c <- doMoreStuff(b) | |
} yield c |
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
for { | |
a <- list.headOption | |
b <- doSomething(a) | |
c <- doSomethingElse(b) | |
} yield c |