Skip to content

Instantly share code, notes, and snippets.

@flash42
flash42 / Bacon_polling_and_errors.md
Last active August 29, 2015 14:09
Can we find a better way for shutting down polling and throwing errors in Bacon.js?
Unsubscribe from polling with ugly unsubBus

I've implemented polling with unsubBus "pattern". Can you suggest something better? Pseudo code:

var unsubBus = new Bacon.Bus();
// Poll job status code until it's successful
var succStream = Bacon.interval(pollInterval)
    .takeUntil(unsubBus)
 .flatMapLatest(function (v) { return this.checkStatus(jobId); })
@flash42
flash42 / concatenative_lisp.clj
Created July 27, 2014 11:58
Comments for elvish documentation Appendix A
(require ['clojure.string :refer '(upper-case)])
;; In Clojure there is a good vector type for storing strings
(def strs ["aha" "LOLaha" "hahaLOL" "hum?"])
;; One can write it in clojure with the concatenative form as well
;; http://clojuredocs.org/clojure_core/clojure.core/-%3E%3E
(->> strs (filter #(re-find #"LOL" %)) (map upper-case) sort)
@flash42
flash42 / list_registered_handler
Created January 18, 2014 13:09
list handler registered for dom element event
jQuery._data(document.getElementsByClassName('eval')[0], "events" ).click[0].handler;