Skip to content

Instantly share code, notes, and snippets.

name := "postgresql-notifications"
version := "1.0"
scalaVersion := "2.11.7"
libraryDependencies ++= Seq("org.postgresql" % "postgresql" % "9.4-1200-jdbc41",
"org.scalikejdbc" %% "scalikejdbc" % "2.2.8",
"com.typesafe.akka" %% "akka-actor" % "2.4-SNAPSHOT",
"org.json4s" %% "json4s-native" % "3.2.10"
--
CREATE OR REPLACE FUNCTION notify_event() RETURNS TRIGGER AS $$ DECLARE
data json;
notification json;
BEGIN
-- Convert the old or new row to JSON, based on the kind of action.
-- Action = DELETE? -> OLD row
-- Action = INSERT or UPDATE? -> NEW row
@josdirksen
josdirksen / Validations.scala
Created August 7, 2015 17:03
Scalaz, Readers and Validations
import scalaz._
import Scalaz._
/**
* Simple example showing how to use the reader pattern together with
* the Scalaz provided ValidationNel to apply validations in a functional
* easily extensible manner.
*/
object ValidationSample extends App {
import java.io.File
import akka.actor._
import akka.routing.{RemoveRoutee, ActorRefRoutee, AddRoutee}
import akka.stream.actor.ActorPublisher
import play.api.libs.json.Json
import scala.annotation.tailrec
import scala.concurrent.duration._
/**
name := "akka-http-websockets"
version := "1.0"
scalaVersion := "2.11.6"
libraryDependencies ++= Seq(
"com.typesafe.akka" %% "akka-stream-experimental" % "1.0-RC2",
"com.typesafe.akka" %% "akka-http-core-experimental" % "1.0-RC2",
"com.typesafe.play" %% "play-json" % "2.3.4"
import akka.typed._
import akka.typed.ScalaDSL._
import akka.typed.AskPattern._
import akka.util.Timeout
import scala.concurrent.Future
import scala.concurrent.duration._
import scala.concurrent.Await
object AkkaTyped extends App {
import akka.typed.patterns.Receiver._
import akka.typed._
import akka.typed.patterns.Receiver
import akka.typed.ScalaDSL._
import scala.concurrent.duration._
object AkkaTypedReceiver extends App {
sealed trait HelloMsg
final case class HelloCountry(country: String) extends HelloMsg
import java.io.{File, FileInputStream}
import java.security.KeyStore
import com.jayway.restassured.RestAssured
import com.jayway.restassured.config.SSLConfig
import com.jayway.restassured.http.ContentType
import com.jayway.restassured.response.Response
import org.apache.http.conn.ssl.{SSLConnectionSocketFactory, SSLSocketFactory}
import org.scalatest._
import AkkaTypedReceptionist.FirstService.{FirstServiceMsg1, FirstServiceMsg}
import AkkaTypedReceptionist.SecondService.{SecondServiceMsg1, SecondServiceMsg}
import AkkaTypedReceptionist.SenderService.{sendMessage, registerAddresses, SenderMsg}
import akka.typed.{ActorSystem, Props, ActorRef, PreStart}
import akka.typed.ScalaDSL._
import akka.typed.patterns.Receptionist
import akka.typed.patterns.Receptionist._
object AkkaTypedReceptionist extends App {
package main
import (
"flag"
"github.com/josdirksen/slackproxy/config"
"github.com/josdirksen/slackproxy/handlers"
"log"
"net/http"
)