Skip to content

Instantly share code, notes, and snippets.

View Maybe.php
<?php
interface Maybe
{
public function ifSome(callable $f): self;
}
View Configuration.java
package com.myproject.myfeature
// Configuration of My Feature
interface Configuration {
// Returns whether the feature is enabled or not
public bool isFeatureEnabled();
}
View Card.scala
final case class Card(private val rank: Rank, private val suit: Suit)
View Card.java
final class Card {
private Rank rank;
private Suit suit;
public Card(Rank rank, Suit suit) {
this.rank = rank;
this.suit = suit;
}
public boolean sameAs(Card anotherCard) {
View Service.java
package com.mywonderfulbnb.bnb.definition
final class Service {
private Bnbs Bnbs;
private ActivatedOwners activatedOwners;
private Publisher publisher;
private Logger logger;
public Service(Bnbs bnbs, ActivatedOwners activatedOwners, Publisher publisher, Logger logger) {
this.bnbs = bnbs;
@nicolopignatelli
nicolopignatelli / Aborted.java
Last active Apr 9, 2019
Result micro-library. Emoji powered.
View Aborted.java
final class Aborted extends Failure {
public Result<T> ✅(Consumer<T> f) {
return this;
}
public Result<T> ❌(Consumer<ExceptionStack> f) {
return this;
}
}
View Bnb.java
package com.mywonderfulbnb.bnb.definition
final class Bnb implements ReadOnlyBnb {
private BnbId bnbId;
private OwnerId ownerId;
private Name name;
private Rooms rooms;
public Bnb(BnbId bnbId, OwnerId ownerId, Name name, Rooms rooms) {
this.bnbId = bnbId;
View Bnbs.java
package com.mywonderfulbnb.bnb.definition
interface Bnbs {
Optional<Bnb> load(BnbId);
void save(Bnb);
}
View Bnb.java
package com.mywonderfulbnb.bnb.definition
final class Bnb {
private BnbId bnbId;
private OwnerId ownerId;
private Name name;
public Bnb(BnbId bnbId, OwnerId ownerId, Name name) {
this.bnbId = bnbId;
this.ownerId = ownerId;
View ActivatedOwnerNotFound.java
package com.mywonderfulbnb.bnb.definition
final class ActivatedOwnerNotFound extends Exception {
private OwnerId ownerId;
public ActivatedOwnerNotFound(OwnerId ownerId) {
this.ownerId = ownerId;
}
}
You can’t perform that action at this time.