Skip to content

Instantly share code, notes, and snippets.

View anonimitoraf's full-sized avatar

Rafael Nicdao anonimitoraf

View GitHub Profile
@anonimitoraf
anonimitoraf / ns-cheatsheet.clj
Created April 12, 2020 13:04 — forked from ghoseb/ns-cheatsheet.clj
Clojure ns syntax cheat-sheet
;;
;; NS CHEATSHEET
;;
;; * :require makes functions available with a namespace prefix
;; and optionally can refer functions to the current ns.
;;
;; * :import refers Java classes to the current namespace.
;;
;; * :refer-clojure affects availability of built-in (clojure.core)
;; functions.
@anonimitoraf
anonimitoraf / doom.txt
Last active June 21, 2020 08:51 — forked from hjertnes/doom.txt
Doom Emacs Cheatsheet
SPC
SPC: find file
, switch buffer
. browse files
: MX
; EX
< switch buffer
` eval
u universal arg
x pop up scratch
@anonimitoraf
anonimitoraf / promise-all.clj
Created March 10, 2020 12:36 — forked from abarnash/promise-all.clj
Clojure implementation of all(promises).then(...) pattern from JavaScript
(defn getPromiseFn
[aPromise]
(fn [num] (Thread/sleep 10000)
(deliver aPromise (str num " done"))))
(def proms [(promise) (promise) (promise)])
(def promFns (map getPromiseFn proms))
(future (map deref proms))
(future (map promFn (range 0 (count proms))))