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
| sealed trait Interact[A] | |
| case class Ask(prompt: String) | |
| extends Interact[String] | |
| case class Tell(msg: String) | |
| extends Interact[Unit] | |
| trait Monad[M[_]] { | |
| def pure[A](a: A): M[A] |
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
| module GroupBy where | |
| import Data.Map (Map) | |
| import qualified Data.Map as Map | |
| groupBy :: Ord b => (a -> b) -> [a] -> Map b [a] | |
| groupBy f = foldr (\ v -> Map.insertWith (++) (f v) [v]) Map.empty | |
| groupBy' :: Ord b => (a -> b) -> [a] -> Map b [a] |
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
| <html> | |
| <body> | |
| GET squawk:<br /> | |
| {{ squawk_get }}<br /><br /> | |
| POST squawk:<br /> | |
| {{ squawk_post }}<br /><br /> | |
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
| %% -*- erlang-indent-level: 4;indent-tabs-mode: nil -*- | |
| %% ex: ts=4 sw=4 et | |
| %% @author Kevin Smith <[email protected]> | |
| %% @copyright 2011 Opscode, Inc. | |
| -module(example). | |
| -behaviour(gen_server). | |
| -export([start_link/0]). |
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
| private object DBVendor extends Logger { | |
| def apply(prefix: String) = { | |
| List("driver", "url", "user", "password").flatMap(str => Props.get(prefix + ".db." + str)) match { | |
| case driver :: url :: user :: password :: Nil => | |
| new DBVendor(driver, url, user, password, Props.get(prefix + ".db.ssl"), Props.get(prefix + ".db.sslfactory")) | |
| case _ => | |
| throw new Exception("The database connection properties could not be found.") | |
| } | |
| } | |
| } |
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
| # Get the 1.0.1 version of SSL | |
| brew install openssl | |
| ./configure --disable-hipe --enable-smp-support --enable-threads --enable-kernel-poll --enable-darwin-64bit --with-ssl=/usr/local/opt/openssl | |
| touch lib/wx/SKIP lib/odbc/SKIP | |
| make -j8 | |
| sudo make install |
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
| private object DBVendor extends Logger { | |
| def apply(prefix: String) = { | |
| List("driver", "url", "user", "password").flatMap(str => Props.get(prefix + ".db." + str)) match { | |
| case driver :: url :: user :: password :: Nil => | |
| new DBVendor(driver, url, user, password, Props.get(prefix + ".db.ssl"), Props.get(prefix + ".db.sslfactory")) | |
| case _ => | |
| throw new Exception("The database connection properties could not be found.") | |
| } | |
| } | |
| } |
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.concurrent.Actor | |
| import collection.mutable.ArrayBuffer | |
| import java.util.Timer | |
| /** | |
| * Usage: | |
| * | |
| * <code> | |
| * val buffer = BufferActor[String](onFlush = _ foreach (println(_), onError = println(_)) | |
| * buffer ! "Now we're talking!" |
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
| package trial.scalaz | |
| package actors | |
| import java.util.concurrent.CountDownLatch | |
| import scalaz.Scalaz._ | |
| import scalaz.concurrent.Actor | |
| sealed abstract class PingPong | |
| case class Ping(sender: Actor[Pong]) extends PingPong | |
| case class Pong(sender: Actor[Ping]) extends PingPong |
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 java.io.IOException; | |
| import java.util.List; | |
| import org.slf4j.Logger; | |
| import org.slf4j.LoggerFactory; | |
| import junit.framework.TestCase; | |
| import com.basho.riak.client.IRiakObject; | |
| import com.basho.riak.client.builders.RiakObjectBuilder; |