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 com.thoughtworks.futureeither | |
import concurrent.{Await, Future} | |
import scala.concurrent.ExecutionContext.Implicits.global | |
import concurrent.duration.FiniteDuration | |
import java.util.concurrent.TimeUnit | |
class FutureEither[L, R](private val future: Future[Either[L, R]]) { | |
def flatMap[R2](block: R => FutureEither[L, R2]): FutureEither[L, R2] = { |
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 WreckedCast { | |
@SuppressWarnings("unchecked") | |
static <P, PP extends Parametric<P>> PP wreckedCast(Parametric<? extends Parametric<P>> ppp) { | |
return (PP) ppp.extract(); | |
} | |
public static void main(String[] args) { | |
// java.lang.ClassCastException: WreckedCast$Parametric$$Lambda$1/1607521710 cannot be cast to java.lang.String | |
System.out.println(wreckedCast(Parametric.parametric(Parametric.parametric(1)))); |
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 example; | |
import com.jnape.dynamiccollection.lambda.Accumulator; | |
import com.jnape.dynamiccollection.list.DynamicList; | |
import java.util.List; | |
import static com.jnape.dynamiccollection.DynamicCollectionFactory.list; | |
public class Example { |
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 java.io.IOException; | |
public class ExceptionalExceptionHandling { | |
public static void main(String[] args) { | |
ThrowingSupplier<IllegalStateException, String> wellTyped = () -> { | |
throw new IllegalStateException(); | |
}; | |
ThrowingSupplier<RuntimeException, String> wellTypedButUnnecessary = () -> { |
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 com.jnape.palatable.lambda.adt.Either; | |
import com.jnape.palatable.lambda.functions.Fn3; | |
import com.jnape.palatable.lambda.functor.Functor; | |
import com.jnape.palatable.lambda.functor.builtin.Identity; | |
import java.util.function.Function; | |
import static com.jnape.palatable.lambda.adt.Either.left; | |
import static com.jnape.palatable.lambda.adt.Either.right; |
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 example; | |
import java.util.Optional; | |
class Foo {} | |
interface Bar { | |
String barMethod(); | |
} | |
public class TypeUnifailcation extends Foo implements Bar { |
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
#top: | |
Change: position: absolute; to position: fixed; | |
Change: top: -40px; to top: 0; | |
#left, #right: | |
Change: position: relative; to position: fixed; | |
#main: | |
Remove: position: relative; | |
Add: margin-left: 381px; |
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
% The person who has to deploy to Mobile is not Max or Sam | |
% Neither Max or Charlie are fans of Copying Files | |
% The one who deploys quarterly does so to a Mobile target | |
% Andy deploys weekly | |
% The person making use of a third party PAAS is not Andy or Charlie | |
% Sam is either the Copying Files or the System Package enthusiast | |
% The person who makes VM Images is not Charlie and doesn’t own deploy to a PAAS | |
% The person who deploys to the PAAS is does so more frequently than the person who deploys to the Desktop | |
% Of the System Packaging fan and Charlie, one deploys monthly and the other deploys to Mobile | |
% The person who deploys to the IAAS is not Max |
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
from unittest2 import TestCase | |
from mockito import when, unstub | |
from uuid import UUID | |
import uuid | |
def use_mocking(test_suite): | |
wrapped_tearDown = test_suite.tearDown if 'tearDown' in dir(test_suite) else lambda self: True | |
def tearDown(self): |
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 com.thoughtworks.futureeither | |
import scala.collection.mutable | |
abstract sealed class LoopOutcome { | |
def endOrElse(fn: => Any) = this match { | |
case Repeat() => fn | |
case _ => | |
} |