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.stream._ | |
import Process._ | |
import scalaz.concurrent.Task | |
import scala.concurrent.duration._ | |
// git bisect identifies the offending commit as | |
// https://github.com/scalaz/scalaz-stream/commit/721716ed7af0c126593e9ee227c0f36f21c5b7ed | |
object Test { |
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
// In real life, it's great that stuff gets restarted when it fails. | |
// In testing, we'd rather know that it failed. | |
import akka.actor._ | |
class DyingActor extends Actor { | |
def receive = { case "die" => throw new Exception("poo") } | |
} | |
// Default config, everything restarts automatically | |
val system = ActorSystem("ordinary") |
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
scala> class Banana[P] {} | |
defined class Banana | |
// We will know when this gets called, when the banana is needed | |
scala> implicit def myBanana[P]: Banana[P] = { println("banana time"); new Banana[P] } | |
myBanana: [P]=> Banana[P] | |
// method with implicits | |
scala> def addWithBanana(one: Int)(two: Int)(implicit banana: Banana[Int]) = {println(banana); one + two} |
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
var completeSale = function(num) { | |
console.log("Sale " + num + ": selling " + this.items + " to " + this.customer); | |
} | |
var foo = { | |
customer: "Fred", | |
items: ["carrot","eggs"], | |
complete: completeSale | |
}; |
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
(defn addCustomer [sale, cust] (assoc sale :customer cust)) | |
(defn addItems [sale, items] (assoc sale :items items)) | |
(defn complete [sale, num] (println "Sale" num ": selling" (:items sale) "to" (:customer sale))) | |
(def sale { :store "Downtown" }) | |
(-> sale | |
(addCustomer "Fred") | |
(addItems ["carrot", "eggs"]) | |
(complete 100) |
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
== Summum Bonum, by Robert Browning == | |
All the breath and the bloom of the year | |
In the bag of one bee | |
All the wonder and wealth of the mine | |
In the heart of one gem | |
In the core of one pearl all the shade | |
And the shine of the sea | |
Breath and bloom, shade and shine, wonder, wealth, | |
And how far above them | |
Truth that's brighter than gem |
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
module Box (Model, init, Action, update, view) where | |
import Html exposing (..) | |
import Html.Attributes exposing (style) | |
import Html.Events exposing (onClick) | |
-- MODEL | |
type alias Model = () |
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
module Failure where | |
import InnerComponent | |
--- ACTION | |
type InnerAction = InnerComponent.Action -- oops, meant type alias | |
type Action = Passthru InnerAction | |
-- MODEL |
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
module EffectsTest where | |
import Html exposing (..) | |
import Html.Events exposing (onClick) | |
import StartApp exposing (App) | |
import Task exposing (Task) | |
import Effects exposing (Effects, Never) | |
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.xml._ | |
// curl http://rest.codemash.org/api/speakers > speakers.xml | |
val speakers = xml.XML.loadFile("codemashSpeakers.xml") \ "Speaker" | |
// curl http://rest.codemash.org/api/sessions > sessions.xml | |
val sessions = xml.XML.loadFile("sessions.xml") \ "Session" | |
val masculineWords = List("he","his") | |
val feminineWords = List("she","her","hers","lady") | |
def bioContainsAnyWord( strings : Seq[String], speakerNode : Node) = |
OlderNewer