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
// Implementing the publishing Pusher REST API | |
// @see http://pusher.com/docs/rest_api | |
// with Play (scala) Framework | |
// @see http://scala.playframework.org/ | |
class Pusher { | |
val appId = Play.configuration.getProperty("pusher.appId") | |
val key = Play.configuration.getProperty("pusher.key") | |
val secret = Play.configuration.getProperty("pusher.secret") | |
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
//send messages via Pusher API in play 2.4 | |
import play.api.libs.json.{ Writes, Json } | |
import play.api.libs.ws.{ WSResponse, WSClient } | |
import play.api.libs.ws.ning.NingWSClient | |
import java.security.MessageDigest | |
import java.math.BigInteger | |
import javax.crypto.Mac | |
import javax.crypto.spec.SecretKeySpec | |
import scala.concurrent.{ ExecutionContext, Future } |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<configuration> | |
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> | |
<encoder> | |
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern> | |
</encoder> | |
</appender> | |
<logger name="com.amazonaws" level="ERROR"/> | |
<logger name="org.apache.http" level="ERROR"/> |
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
lazy val toByteArray: InputStream => Array[Byte] = | |
is => { | |
val output = new ByteArrayOutputStream() | |
try { | |
val b = new Array[Byte](4096) | |
var n = is.read(b) | |
while ( n != -1 ) { | |
output.write(b, 0, n) | |
n = is.read(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
object OnOffStdOutErrG { | |
import java.io.{OutputStream, PrintStream} | |
private[this] val (originalStdOut, originalStdErr) = (System.out, System.err) | |
/** A PrintStream for "/dev/null": all write() invocations are no-ops. */ | |
val devnull = new PrintStream( | |
new OutputStream() { | |
override def write(ignore: Int): Unit = { /* nothing !! */ } |
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 simulacrum.typeclass | |
import scala.language.higherKinds | |
@typeclass trait Fold[F[_]] { | |
def foldLeft[A, B](f: F[A])(zero: B)(combine: (B, A) => B): B | |
} | |
object FoldImplicits { |
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 fif.Data | |
import scala.language.higherKinds | |
import scalaz.{ -\/, \/-, \/ } | |
object ModelTrainer { | |
type Err[T] = \/[Throwable, T] |
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.\/ | |
trait Runner { | |
import Helpers.{ log, time, end } | |
type Args | |
val helpMsg: 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
Hi all, | |
Thanks to the splendid work detailing how to run Ubuntu 15.10 on the Dell XPS 15 9550 (started by @jchedstrom and followed up by many others) and the latest specific posts on running Ubuntu 16.04 beta (by @Rommel_Lapuz, and others), I decided to open a new thread on the forum for the Ubuntu 16.04 version, share my experience, and discuss any pending issues. | |
UPDATE 2016/04/20: I just found another great information resource on running Linux on the XPS15 9550: http://wiki.yobi.be/wiki/Laptop_Dell_XPS_15 | |
My hardware configuration is (my system shipped mid february): | |
Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz | |
32G DDR4 RAM |
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.{ &&, Tag } | |
sealed trait H | |
type Height = Int @@ H | |
object Height { | |
def apply(x: Int): Height = Tag[Int, H](x) | |
def apply(x: Height): Int = Tag.unwrap(x) | |
} | |
sealed trait W |