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 com.gaiam.gcsi.util; | |
import javax.jms.Connection; | |
import javax.jms.ConnectionFactory; | |
import javax.jms.JMSException; | |
import javax.jms.Message; | |
import javax.jms.MessageProducer; | |
import javax.jms.Queue; | |
import javax.jms.Session; |
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
class WiredUser { | |
val userToWire = (Users.userForDisplay or userDetail.currentValue).get | |
private object User { | |
val entity = ValueCell(userToWire) | |
val edit = ValueCell(false) | |
val email = edit.lift(b => entity.lift(_.getEmail.asScala.headOption).get) | |
} |
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
/* | |
* Created by IntelliJ IDEA. | |
* User: tstevens | |
* Date: 4/30/11 | |
* Time: 3:50 PM | |
*/ | |
package com.oletraveler.bmapz | |
import xml.{NodeSeq, Elem} |
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 xml = <dependencies> | |
<dependency> | |
<groupId>javax.persistence</groupId> | |
<artifactId>persistence-api</artifactId> | |
<version>1.0</version> | |
<scope>provided</scope> | |
</dependency> | |
<dependency> | |
<groupId>net.sf.oval</groupId> | |
<artifactId>oval</artifactId> |
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
def lineToOffer(line: String, headers: List[String]) : Validation[NonEmptyList[String], Offer] = { | |
({commaSplit(_)} andThen {extractFields(_: List[String], headers)} apply line) :-> | |
{(v) => Offer(v._1, v._2, v._3, v._4)} | |
} | |
def commaSplit(l: String): String => List[String] = l.split(",").toList | |
def extractFields(x: List[String], headers: List[String]): Validation[NonEmptyList[String], (String, String, String, String)] = { | |
notEmpty(x(headers.indexOf("offer_name")), "No offer name specified on line:" + x.mkString(","))) <|***|> ( | |
notEmpty(x(headers.indexOf("email")), "No email specified on line:" + x.mkString(",")), |
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 validInt: String => ValidationNEL[String, Int] = s => | |
for { | |
validStr <- (allDigits(s) |@| maxSizeOfTen(s))((_,x) => x) | |
i <- toInt(validStr) | |
} yield(i) |
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 A { | |
def a: String => String | |
} | |
trait B { | |
//TypeOf is something magical | |
def b: TypeOf[A.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
package com.czarism.blog | |
import scalaz._ | |
import Scalaz._ | |
/** | |
* Created by tstevens on 7/18/14. | |
*/ | |
object FavorValidation { |
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
def maxTen(i: Int) = | |
if (i <= 10) \/-(i) | |
else "Must be less than ten" | |
def divisibleByTwo(i: Int) = | |
if (i % 2 == 0) == 0 \/-(i) | |
else "Must be divisable by two" | |
def whatType(input: Int): ???[NonEmptyList[String], Int] = | |
( parseInt(input) |@| divisibleByTow(input) ) |
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 PaymentSource { | |
def accept[T](visitor: PsVisitor[T]) : T | |
} | |
class CreditCard extends PaymentSource{ | |
override def accept[T](visitor: PsVisitor[T]) = { | |
visitor.visit(this) | |
} | |
} |
OlderNewer