Skip to content

Instantly share code, notes, and snippets.

@LeifW
LeifW / cheat_sheet.md
Last active August 16, 2017 03:35
Optional / Either / CompletableFuture similarities
Optional Either CompletableFuture
Create success value Optional.of Either.right CompletableFuture.completedFuture
Create failure value Optional.empty Either.left f = new CompletableFuture(); f.completeExceptionally; return f
Apply function to success case .map .map .thenApply
Apply a function to success case that may also fail .flatMap .flatMap .thenCompose
Handle both failure & sucess cases at once .map().orElse() .fold .handle
;; This is the sort of thing that makes me think you'd enjoy using one
;; of the better Common Lisp implementations for certain kinds of
;; work. I'm using the latest version of SBCL here.
;; Ok, contrived example, but easy to imagine the code that it should
;; generate...
(defun add (x y)
(+ x y))
@dbaeck
dbaeck / lumen_in_subfolder.md
Created May 6, 2015 10:25
Howto deploy Lumen projects within a subfolder (on a shared hoster)

Howto deploy Lumen projects within a subfolder (on a shared hoster)

For Lumen (5.0.8) (Laravel Components 5.0.*)

Use Case: Deploying Lumen App to Shared Hoster such that it can be called via domain.tld/lumenapp/...

Folder Layout

  • Rename public to desired name (new root folder, for example lumenapp)
  • Move everything else into a new folder, named e.g. project_src