Skip to content

Instantly share code, notes, and snippets.

private final Subject<CurrentJob, CurrentJob> jobSubject = PublishSubject.create();
private final Observable<CurrentJob> jobObservable = jobSubject
.flatMap(job -> api call etc...)
.doOnNext(job -> job.toReadEvents().forEach(this::processJobReadEvent));
...
startDocument() {
jobObservable.subscribe();
}
endJob() {
@josuf107
josuf107 / Html.hs
Created November 22, 2014 23:11
Haskell Html builder using polyvariadic functions
import Data.Monoid
class IsNodes ns where
toNodes :: ns -> Nodes
fromSeveral :: [ns] -> Nodes
instance IsNodes Nodes where
toNodes = id
fromSeveral = mconcat
@josuf107
josuf107 / HelloElben.hs
Created September 28, 2014 00:52
Hello World Birthday Boy Edition
import Prelude (id, putStr, putStrLn, (>>))
main =
elben eats for breakfast the abstractions that choke lesser programmers.
whithout a second thought he swims through code that would drown lesser swimmers
@josuf107
josuf107 / .vimrc
Last active August 29, 2015 13:57
Latex Quotes
augroup filetype_tex
autocmd!
autocmd Filetype tex let b:inquote = 0
autocmd Filetype tex inoremap <buffer> " <esc>:call <SID>LQuote()<cr>a
augroup END
function! <SID>LQuote()
if b:inquote
let q = "''"
else
@josuf107
josuf107 / Image.Types
Last active January 3, 2016 19:49
Restricting values
module Image.Types
( Image (Image)
, Stroke (Line, Arc, Spot)
, Point (Point)
, Pen (Circle, Rectangle, ArbitraryPen)
, pen
, arcCircle
, lineRectangle
, lineCircle
) where