Skip to content

Instantly share code, notes, and snippets.

@kiumars
kiumars / AppTest.java
Created April 17, 2017 13:10 — forked from Christopher-Barham-AKQA/AppTest.java
Example jUnit test that demos/uses most of the hamcrest matchers
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.allOf;
import static org.hamcrest.Matchers.any;
import static org.hamcrest.Matchers.anyOf;
import static org.hamcrest.Matchers.anything;
import static org.hamcrest.Matchers.describedAs;
import static org.hamcrest.Matchers.endsWith;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.equalToIgnoringWhiteSpace;
import static org.hamcrest.Matchers.instanceOf;
@kiumars
kiumars / b.rb
Created November 6, 2017 13:55 — forked from junegunn/b.rb
b - browse Chrome bookmarks with fzf
#!/usr/bin/env bash
# vim: set filetype=ruby:
# b - browse Chrome bookmarks with fzf
[ $(uname) = Darwin ] || exit 1
which fzf > /dev/null 2>&1 || brew reinstall --HEAD fzf || exit 1
/usr/bin/ruby -x "$0" |
fzf-tmux -u 30% --ansi --multi --no-hscroll --tiebreak=begin |
awk 'BEGIN { FS = "\t" } { print $2 }' |
@kiumars
kiumars / README.md
Created February 18, 2022 14:17 — forked from marc0der/README.md

Functional error handling in Kotlin

Agenda:

  • About the (simple) exercise
  • Higher Order Functions
  • Throwing exceptions: here be dragons!!
  • Sentinel values: better but not great
  • The Option: error as an ADT
  • Functional combinators: add some sugar