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 bad.robot; | |
import fj.F; | |
import java.util.function.Function; | |
import java.util.stream.Stream; | |
public interface Either<A, B> { | |
static <A, B> Either<A, B> left(final A a) { |
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 maprec[B](f: A => B): List[B] = { | |
def recur(head: A, tail: List[A]): List[B] = { | |
tail match { | |
case Nil => List(f.apply(head)) | |
case _ => f.apply(head) +: recur(tail.head, tail.tail) | |
} | |
} | |
recur(elements.head, elements.tail) |
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 bad.robot.radiate | |
import java.util.concurrent.Callable | |
import java.util.function.{Consumer, Supplier} | |
object FunctionInterfaceOps { | |
implicit def toConsumer[A](function: A => Unit): Consumer[A] = new Consumer[A]() { | |
override def accept(arg: A): Unit = function.apply(arg) | |
} |
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 auctionsniper.util; | |
import org.jmock.Expectations; | |
import org.jmock.Mockery; | |
import org.jmock.integration.junit4.JMock; | |
import org.junit.Test; | |
import org.junit.runner.RunWith; | |
import java.util.EventListener; |
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
# my _config.yml section | |
root: / | |
permalink: /blog/:year/:month/:day/:title/ | |
source: source | |
destination: public/blog | |
code_dir: downloads/code | |
category_dir: blog/categories | |
This deploys fine to github pages (https://github.com/tobyweston/blog) and with a CNAME badrobot.com |
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
public static class ButtWipe { | |
public static <K, V> MapBuilder<K, V> map(K key, V value) { | |
return new MapBuilder<K, V>().map(key, value); | |
} | |
public static class MapBuilder<K, V> extends HashMap<K, V> { | |
private MapBuilder() { | |
} |
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
Name: Interrupter-Thread-1 | |
State: BLOCKED on java.lang.Object@381eb0c6 owned by: main | |
Total blocked: 1 Total waited: 0 | |
Stack trace: | |
org.jmock.lib.concurrent.Synchroniser.synchroniseInvocation(Synchroniser.java:82) | |
org.jmock.lib.concurrent.Synchroniser.access$000(Synchroniser.java:23) | |
org.jmock.lib.concurrent.Synchroniser$1.invoke(Synchroniser.java:74) | |
org.jmock.lib.legacy.ClassImposteriser$4.invoke(ClassImposteriser.java:136) | |
com.google.code.tempusfugit.temporal.Clock$$EnhancerByCGLIB$$489249d6.create(<generated>) |
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
public static class SingleThreadedPolicyAvoidingFinaliseProblems extends SingleThreadedPolicy { | |
@Override | |
public Invokable synchroniseAccessTo(final Invokable mockObject) { | |
final Invokable synchronizedMockObject = super.synchroniseAccessTo(mockObject); | |
return new Invokable() { | |
@Override | |
public Object invoke(Invocation invocation) throws Throwable { | |
if (Thread.currentThread().getName().equalsIgnoreCase("Finalizer")) | |
return mockObject.invoke(invocation); | |
return synchronizedMockObject.invoke(invocation); |
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
class ProductionHibernateConfiguration implements HibernateConfiguration { | |
@Override | |
public Properties getProperties(String connectionUrl, String userName, String password) { | |
Properties properties = new Properties(); | |
properties.setProperty("hibernate.connection.driver_class", "net.bull.javamelody.JdbcDriver"); | |
properties.setProperty("hibernate.connection.driver", "oracle.jdbc.driver.OracleDriver"); | |
properties.setProperty("hibernate.connection.url", connectionUrl); | |
properties.setProperty("hibernate.connection.username", userName); | |
properties.setProperty("hibernate.connection.password", password); | |
properties.setProperty("hibernate.dialect", "org.hibernate.dialect.Oracle10gDialect"); |
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
public class TaxRate extends AbstractValueType<Double> { | |
public static TaxRate taxRate(Double value) { | |
return new TaxRate(value); | |
} | |
private TaxRate(Double value) { | |
super(value); | |
} |
OlderNewer