Using JSON in Postgres by example.
- Download and install: Docker Toolbox
- Open Docker Quickstart Terminal
- Start a new postgres container:
docker run --name my-postgres -e POSTGRES_PASSWORD=mysecretpassword -d postgres
#!/usr/bin/env bash | |
# Use this one-liner to produce a JSON literal from the Git log: | |
git log \ | |
--pretty=format:'{%n "commit": "%H",%n "author": "%an <%ae>",%n "date": "%ad",%n "message": "%f"%n},' \ | |
$@ | \ | |
perl -pe 'BEGIN{print "["}; END{print "]\n"}' | \ | |
perl -pe 's/},]/}]/' |
import scala.concurrent.Future | |
object either { | |
// Scala standard library Either is sometimes used to distinguish between 'failure' and 'success' state. Like these two methods: | |
def getUser(id: String): Either[String, User] = ??? | |
def getPreferences(user: User): Either[String, Preferences] = ??? | |
// The Right side contains the success value by convention, because right is right, right? |
package globals | |
import java.io.PrintStream | |
import play.api.Logger | |
object StdOutErrLogger { | |
val logger = Logger(this.getClass) | |
def redirectSystemOutAndErrToLog() = { |
Using JSON in Postgres by example.
docker run --name my-postgres -e POSTGRES_PASSWORD=mysecretpassword -d postgres