Skip to content

Instantly share code, notes, and snippets.

View guruma's full-sized avatar

Sang-Kyu Park guruma

View GitHub Profile
(ns ch3.core)
;;;;;;;;;;;;;;
;; Chapter 3
;;;;;;;;;;;;;;
;; 리스트는 앞에 추가한다.
(def lst '(1 2 3))
(conj lst 0)
(conj lst 0 -1) ; 여러개 추가 가능
@guruma
guruma / random UUID
Created July 29, 2017 06:44
make UUID ramdomly
(java.util.UUID/randomUUID)
@guruma
guruma / oop-member-simple-access.clj
Last active September 4, 2016 13:51
def-type : 멤버 변수 접근자 함수를 간단하게...
(defmacro ? [o prop]
(let [get-prop# (symbol (str "get-" prop))]
`(~get-prop# ~o)))
(defmacro ! [o prop val]
(let [set-prop# (symbol (str "set-" prop))]
`(~set-prop# ~o ~val)))
(defmacro def-access-method [field]
(let [get-method# (symbol (str "get-" field))
;; (require '[clojure.string :as str] '[clojure.java.shell :as shell] '[taoensso.timbre :as timbre])
(defn with-free-port!
"Attempts to kill any current port-binding process, then repeatedly executes
nullary `bind-port!-fn` (which must return logical true on successful
binding). Returns the function's result when successful, else throws an
exception. *nix only.
This idea courtesy of Feng Shen, Ref. http://goo.gl/kEolu."
[port bind-port!-fn & {:keys [max-attempts sleep-ms]