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
/* This is how I am globally handling fatal exceptions thrown from Rx subscribers. | |
* It is what I came up with in response to my stackoverflow question here | |
* http://stackoverflow.com/questions/7210051/catching-exceptions-which-may-be-thrown-from-a-subscription-onnext-action | |
* This is far from ideal. From what I understand, exception handling has been improved greately in Rx for .NET 4.5 | |
*/ | |
using System; | |
using System.Collections.Generic; | |
using System.Threading; | |
using System.Threading.Tasks; |
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
package com.bostontechnologies.cscore.amqp | |
import com.weiglewilczek.slf4s.Logging | |
import collection.JavaConversions._ | |
import collection.mutable.{SynchronizedSet, HashSet, ConcurrentMap} | |
import java.lang.String | |
import java.util.concurrent.ConcurrentHashMap | |
import java.util.concurrent.atomic.AtomicBoolean | |
import org.springframework.amqp.core.{Queue, Binding, AmqpAdmin, Exchange} | |
import org.springframework.amqp.rabbit.core.RabbitAdmin |
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
package com.mypackage | |
import org.specs.SpecificationWithJUnit | |
import scalaz._ | |
import Scalaz._ | |
class ValidationTests extends SpecificationWithJUnit { | |
"I should be able to convert List[Validation[A, B]] to Validation[List[A], List[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
Show hidden characters
/* | |
On OS X, basic text manipulations (left, right, command+left, etc) make use of the system key bindings, | |
and don't need to be repeated here. Anything listed here will take precedence, however. | |
*/ | |
[ | |
{ "keys": ["home"], "command": "move_to", "args": {"to": "bol"} }, | |
{ "keys": ["end"], "command": "move_to", "args": {"to": "eol"} }, | |
{ "keys": ["shift+end"], "command": "move_to", "args": {"to": "eol", "extend": true} }, | |
{ "keys": ["shift+home"], "command": "move_to", "args": {"to": "bol", "extend": true } }, | |
... |
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
package com.bifflabs | |
import org.scalatest.FunSuite | |
import scalaz._ | |
import scalaz.Scalaz._ | |
class TestHelpersSuiteWithScalazSupport extends FunSuite with IgnoringDefaultEqualizer { | |
import AssertionsWithScalazSupport._ | |
test("1 should equal 1") { |
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
def allDigits: (String) => ValidationNEL[String, String] | |
def maxSizeOfTen: (String) => ValidationNEL[String, String] | |
def toInt: (String) => ValidationNEL[String, Int] | |
val validInt: String => ValidationNEL[String, Int] = s => | |
for { | |
validStr <- (allDigits(s) |@| maxSizeOfTen(s))((_,x) => x) | |
i <- toInt(validStr) |
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 FuturePimps { | |
/** | |
* Use this instead of new AlreadyCompletedFuture[T] to prevent accidental use of default Akka timeout | |
**/ | |
def alreadyCompletedFuture[T](v: T)(implicit timeout: Timeout): AlreadyCompletedFuture[T] = | |
new AlreadyCompletedFuture[T](Right(v), timeout.duration.toMillis) | |
class FutureFuture[T](f: () => Future[Future[T]]) { | |
def flatten: Future[T] = f().flatMap(identity) |
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
Welcome to Scala version 2.10.1 (Java HotSpot(TM) 64-Bit Server VM, Java 1.7.0_15). | |
Type in expressions to have them evaluated. | |
Type :help for more information. | |
scala> val opt: Option[Int] = Some(10) | |
opt: Option[Int] = Some(10) | |
scala> val typeCheckFail = opt map (_ + "2") getOrElse (3) | |
typeCheckFail: Any = 102 |
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.std.anyVal._ | |
import scalaz.std.tuple._ | |
import scalaz.std.option._ | |
import scalaz.StateT | |
import scalaz.State | |
import scalaz.Free | |
import scalaz.Free._ | |
import scalaz.State._ | |
import scalaz.Trampoline._ | |
import scalaz.syntax.traverse._ |
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 scala.collection.immutable | |
import scalaz.std.string._ | |
import scalaz.std.list._ | |
import scalaz.std.anyVal._ | |
import scalaz.std.option._ | |
import scalaz.syntax.show._ | |
import scalaz.concurrent.Task | |
import scalaz.stream.{process1, io, Process} | |
import scalaz.stream.Process._ |
OlderNewer