Skip to content

Instantly share code, notes, and snippets.

@williamboxhall
williamboxhall / iterables.scala
Created December 23, 2014 05:47
higher order functions w/ generic collections
val setToSet: Set[Int] => Set[String] = { _.map(_.toString + "potato")}
val listToList: List[Int] => List[String] = { _.map(_.toString + "tomato")}
val listToIterable: List[Int] => Iterable[String] = { _.map(_.toString + "ristretto")}
println(setToSet(Set(1,2)))
println(listToList(List(1,2)))
println(listToIterable(List(1,2)))
def printer(fn: Iterable[Int] => Iterable[String], inputs: Iterable[Int]) = println(fn(inputs))
printer(setToSet, Set(1,2)) // doesn't compile
printer(listToList, List(1,2)) // doesn't compile
@williamboxhall
williamboxhall / BDDContrivedScenario.java
Last active August 29, 2015 14:01
BDD End-to-End Scenario example
package org.example.feature;
...
public class BDDContrivedScenario extends Scenario {
private Mail mail;
@Given("I have sent a mail to two people with response required")
public void givenIHaveSentAMailToTwoPeopleWithResponseRequired() {
as(ME).on(HOTEL_VIP).onThe(NEW_MAIL_PAGE).createAndSend(responseRequiredMailTo(COLLEAGUE, AFFILIATE));
<web-app id="WebApp_ID" version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<display-name>Spring Web MVC Application</display-name>
<servlet>
<servlet-name>rest</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
app
core
src/main/java/org/example
presentation
ValidationDto
ValidationJSONConverter
ValidationHandlerExceptionResolver
infrastructure
EnrichedReadWriteHibernateRepository
SessionFactoryFactory