portmaster irc/irssi
portmaster irc/irssi-xmpp
brew install irssi
Welcome to Scala version 2.10.2 (Java HotSpot(TM) 64-Bit Server VM, Java 1.7.0_21). | |
Type in expressions to have them evaluated. | |
Type :help for more information. | |
scala> import shapeless._ | |
import shapeless._ | |
scala> import syntax.tuple._ | |
import syntax.tuple._ |
object ArgonautPlay { | |
implicit val writeableJson: Writeable[Json] = { | |
// TODO this should explicitly be a UTF-8 encoder | |
val stringWriter = implicitly[Writeable[String]].transform | |
Writeable((a: Json) => stringWriter(a.spaces2), Some("application/json; charset=utf-8")) | |
} | |
} |
import com.clarifi.machines._ | |
import play.api.libs.iteratee.{ Enumerator, Input, Iteratee } | |
import play.api.libs.concurrent.Execution.Implicits._ | |
import scala.concurrent.Future | |
def simple[K, E](machine: Machine[K, E]): Enumerator[E] = new Enumerator[E] { | |
def apply[A](start: Iteratee[E, A]): Future[Iteratee[E, A]] = | |
val result = machine.foldLeft(Future.successful(start)) { (future, value) ⇒ |
The z in scalaz means this: it was early 2008 and I was working for a Java consultancy and so of course, I used the most appropriate tool for the job: scala. But it had *terrible* libraries, so I offered to fix those while also meeting my other objectives. Turns out that the Scala guys were extremely hostile to even half-decent libraries (and still are to this day). I still struggle to wrap my head around this sometimes. | |
Anyway, so I thought, well fuck it, I will just keep them to myself for now. My (awesome) employer had already agreed that we'd probably open-source such a thing, but I was concerned most about my primary goal. So then it came time to "name" this library. I had named it "scalax" simply so that I did not have the inclination to think of a proper name. Then I found out that such a library was being developed and with my internal name! Whatever, I thought. | |
So I looked at this scalax library, hoping that I could just abandon my efforts and jump on board with everyone else -- they too had figure |
// This character generator is similar to the default one from ScalaCheck, but it filters out: | |
// 1. Unprintable control characters. These cause problems in Mongo queries, and should not able | |
// to get into our database since they will not be present in inputs parsed from HTTP text. | |
// 2. Characters that do not exist in the default platform encoding. We can exclude a big range | |
// of these right away (which ScalaCheck does) because they're in the range used for two- | |
// character UTF-16 sequences, but others are only detected by checking Character.isDefined(_). | |
// The symptom of using a bad character in a string is that when you encode it to UTF-8 and | |
// back again, you get a different string, so any of our web and database tests that check the | |
// input against the output may fail-- and you'll see a question mark somewhere in the data, | |
// since that's how bad characters are displayed. |
case class Utf8String(value: String) | |
object Utf8String { | |
implicit val ArbitraryUtf8String: Arbitrary[Utf8String] = | |
Arbitrary(arbitrary[String] map (k => | |
Utf8String(k filter (c => c < '\ud800' || c > '\udfff')))) | |
} |
package vsxmpp | |
import scalaz.EitherT | |
import scalaz._ | |
import Scalaz._ | |
case class ABC(s:String) | |
object ABC { | |
Welcome to Scala version 2.10.0 (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_37). | |
Type in expressions to have them evaluated. | |
Type :help for more information. | |
scala> val x: Option[Nothing] = None | |
x: Option[Nothing] = None | |
scala> x match { | |
| case Some(a) => a | |
| case None => None |