This file contains hidden or 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
| ;; Cyberpunk Colour Theme | |
| ;; | |
| ;; "and he'd still see the matrix in his sleep, bright lattices of logic | |
| ;; unfolding across that colorless void..." | |
| ;; William Gibson, Neuromancer. | |
| (deftheme cyberpunk | |
| "") | |
| (custom-theme-set-faces |
This file contains hidden or 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
| /* Start by creating a reader for some fake yet conceivable type for executing SQL queries. */ | |
| val dbReader: Reader[Properties, JdbcExecutor] = | |
| for { | |
| driver <- read[String]("db.driver") | |
| uri <- read[String]("db.uri") | |
| user <- read[String]("db.username") | |
| password <- read[String]("db.password") | |
| name <- read[String]("db.pool.name") | |
| minCons <- read[Int]("db.pool.minConnections") |
This file contains hidden or 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.WriterT | |
| import scalaz.NonEmptyList | |
| import scalaz.syntax.id._ | |
| import scalaz.std.option._ | |
| import scalaz.syntax.std.option._ | |
| type OptionLogger[A] = WriterT[Option, NonEmptyList[String], A] | |
| val two: OptionLogger[Int] = WriterT.put(2.some)("The number two".wrapNel) |
This file contains hidden or 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 Push extends SpecializedLiftActor[PushNotification] with Logger { | |
| lazy val server: PushServer = new PushServer( | |
| Props.get("push.app.port").flatMap(asInt).openOr(8888) | |
| ) | |
| /** start accepting new connections */ | |
| spawn { while(true) server.accept() } |
This file contains hidden or 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
| trait Flying | |
| trait Landed | |
| case class Plane[Status]() | |
| def land(p:Plane[Flying])=Plane[Landed]() | |
| def takeOff(p:Plane[Landed])= Plane[Flying]() | |
| val plane = new Plane[Landed]() |
This file contains hidden or 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
| /** | |
| * Part Zero : 10:15 Saturday Night | |
| * | |
| * (In which we will see how to let the type system help you handle failure)... | |
| * | |
| * First let's define a domain. (All the following requires scala 2.9.x and scalaz 6.0) | |
| */ | |
| import scalaz._ | |
| import Scalaz._ |
This file contains hidden or 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
| #!/usr/bin/env sh | |
| ## | |
| # This is script with usefull tips taken from: | |
| # https://github.com/mathiasbynens/dotfiles/blob/master/.osx | |
| # | |
| # install it: | |
| # curl -sL https://raw.github.com/gist/2108403/hack.sh | sh | |
| # |
This file contains hidden or 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
| # stream video from your desktop & audio from another device into an h264/mp3 avi video with VLC | |
| vlc screen:// --screen-fps=12 \ | |
| --input-slave=alsa://hw:1,0 \ | |
| --qt-start-minimized \ | |
| --sout "#transcode{venc=x264,vcodec=h264,fps=12,vb=640,acodec=mp3,channels=1,ab=64}\ | |
| :std{access=file,mux=mp4,dst=screencam-$(date -u +%Y-%m-%d-%s).avi}" |
This file contains hidden or 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
| (* Inspired by this puzzle from NPR: | |
| http://www.npr.org/2012/01/29/146034893/this-puzzle-is-the-pits | |
| (see the 'Next Weeks' challenge section there): | |
| "Next Week's Challenge from listener Ed Pegg Jr.: Write the digits from | |
| 1 to 9 in a line. If you put times signs after the 2 and 4, a plus | |
| sign after the 5, and a minus sign after the 7, you have | |
| 12 x 34 x 5 + 67 - 89, which equals 2018. | |
| That's six years off from our current year 2012. This example uses | |
| four arithmetic symbols. The object is to use just three of the | |
| following arithmetic operations: addition, subtraction, multiplication |
This file contains hidden or 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 publishRpmsTask = publishRpms <<= (streams, packagedArtifact in packageWar) map((out, artifact) => { | |
| val publishDir = System.getProperty("PUBLISH_DIR") match { | |
| case null => | |
| println("PUBLISH_DIR system property is not set. Using default.") | |
| "publish" | |
| case dir => dir | |
| } | |
| val scriptsDir = new File("va/scripts") | |
| Process("./make-rpms.sh %s %s".format(artifact._2, publishDir), scriptsDir) ! out.log | |
| }) |