Thread pools on the JVM should usually be divided into the following three categories:
- CPU-bound
- Blocking IO
- Non-blocking IO polling
Each of these categories has a different optimal configuration and usage pattern.
After scouring the internet and piece-mealing together the correct way to do this, here is a step-by-step, all-in-one-place guide to making logback STFU when running your unit tests.
Save the following as logback-test.xml
under src/test/resources
:
<configuration>
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>%msg%n</pattern>
import org.joda.time._ | |
import monix.execution._ | |
import monix.execution.Scheduler.Implicits.global | |
import java.util.concurrent.TimeUnit | |
import scala.util.control.NonFatal | |
def scheduleOncePerDay(time: LocalTime, now: DateTime = DateTime.now())(cb: () => Unit) | |
(implicit s: Scheduler): Cancelable = { | |
val nextTick = { |
/* | |
Overview | |
-------- | |
To run a query using anorm you need to do three things: | |
1. Connect to the database (with or without a transaction) | |
2. Create an instance of `anorm.SqlQuery` using the `SQL` string interpolator | |
3. Call one of the methods on `SqlQuery` to actually run the query |
Copyright © 2017 Fantasyland Institute of Learning. All rights reserved.
A function is a mapping from one set, called a domain, to another set, called the codomain. A function associates every element in the domain with exactly one element in the codomain. In Scala, both domain and codomain are types.
val square : Int => Int = x => x * x
// let's imagine you have an algebra that has a constructor like the following | |
sealed trait Algebra[A] | |
case class Ext[E, A](e: E, f: E => A) extends Algebra[A] | |
/* | |
* Not at all an uncommon pattern! Basically, this is going to show up any time you're | |
* doing GADTs or GADT-like things, or any sort of type-aligned sequence (in any form). | |
* The problem is that the pattern matcher affixes types in a linear fashion, and thus | |
* will not unify the solution to E between the two parameters. For example: | |
*/ |
Ever had the need to create a branch in a repo on Github without wanting (or being able) to access a local repo?
With the aid of [the Github API][1] and [hurl.it][2] this is a piece of cake!
Just follow these steps:
https://api.github.com/repos/<AUTHOR>/<REPO>/git/refs/heads
https://api.github.com/repos///git/refs
with the following as the POST body :