Keybase proof
I hereby claim:
- I am poetix on github.
- I am poetix (https://keybase.io/poetix) on keybase.
- I have a public key ASDdtm9fCHu0-fJArrQzHByuiG-rDxBbi1TeELZ3YLElBwo
To claim this, I am signing this object:
public String ofNullableExample(Map<String, String> map) { | |
return Optional.ofNullable(map.get(key)) | |
.orElseThrow(() -> new ItemNotFoundException(key)); | |
} | |
public String nullCheckingExample(Map<String, String> map) { | |
String valueAtKey = map.get(key); | |
if (valueAtKey == null) { | |
throw new ItemNotFoundException(key); | |
} |
public final class Person { | |
// Publicly accessible, all parameters validated. | |
public static Person with(String name, int age, String favouriteColour) { | |
checkArgument(age > 0, "age must be greater than 0"); | |
return new Person( | |
checkNotNull(name, "name must not be null"), | |
age, | |
checkNotNull(favouriteColour, "favouriteColour must not be null") |
import { expect } from 'chai'; | |
import 'mocha'; | |
import { mock, instance, when, anyString, verify } from "ts-mockito"; | |
class HelloEndpoint { | |
constructor(private service: HelloService) {} | |
async handle(evt: any): Promise<any> { | |
const greeting = await this.service.sayHello(evt.queryStringParameters.name); | |
return { |
import { expect } from 'chai'; | |
import 'mocha'; | |
class HelloEndpoint { | |
constructor(private service: HelloService) {} | |
async handle(evt: any): Promise<any> { | |
const greeting = await this.service.sayHello(evt.queryStringParameters.name); | |
return { | |
body: greeting |
import { expect } from 'chai'; | |
import 'mocha'; | |
class HelloEndpoint { | |
constructor(private service: HelloService) {} | |
async handle(evt: any): Promise<any> { | |
const greeting = await this.service.sayHello(evt.queryStringParameters.name); | |
return { | |
statusCode: 200, |
I hereby claim:
To claim this, I am signing this object:
module Main where | |
import Prelude | |
import Control.Plus (empty) | |
import Data.Array as A | |
import Data.Set as S | |
import Control.Monad.Eff.Console (log) | |
import Data.Foldable (minimum, maximum) | |
import Data.Maybe (fromMaybe) | |
import Data.String (joinWith, fromCharArray) |
package com.codepoetics.kontinuous | |
import java.sql.Connection | |
import java.sql.PreparedStatement | |
import java.sql.ResultSet | |
data class Foo(val a: String, val b: Int, val c: Double) | |
interface RowN { | |
val selectSql: String |
import qualified Data.Map as Map | |
type SubPaths = Map.Map String Node | |
data Node = Content SubPaths | NoContent SubPaths deriving (Show) | |
content :: [(String, Node)] -> Node | |
content kvs = Content $ Map.fromList kvs | |
nocontent :: [(String, Node)] -> Node | |
nocontent kvs = NoContent $ Map.fromList kvs |
import java.util.function.*; | |
public final class Tunnel<E extends Exception> { | |
public static <E extends Exception, R> R call(Class<? extends E> exceptionClass, Function<Tunnel<E>, R> f) throws E { | |
try { | |
return f.apply(new Tunnel<>()); | |
} catch (TunnelledException e) { | |
throw exceptionClass.cast(e.getCause()); | |
} |