(ctrl-c-hook func-to-call)
then shutdown Clojure agents.
Params:
func-to-call
- function, with no args, which should be executed during ctrl-c event.
Returns: nil
# Set global hook to catch <ctrl-c> event, log it and execute given function, then shutdown Clojure agents. * Params: **`func-to-call`** - function, with no args, which should be executed during ctrl-c event. * Returns: _nil_
(dev-mode?)
Dev mode is turned on/off by symbol dev-mode
defined in namespace user
# Checks if development mode is turned on. Dev mode is turned on/off by symbol `dev-mode` defined in namespace `user` * Returns: _true_ if development mode is turned on. _false_ if development mode is turned off.
(dev-only & body)
If 'development only' mode turned on, returns body
wrapped in do
.
If 'development only' mode is off returns nil.
By default dev-only mode is turned on, when running REPL (:repl alias)
and turned off for other tasks.
If 'development only' mode turned on, returns `body` wrapped in `do`. If 'development only' mode is off returns nil. By default dev-only mode is turned on, when running REPL (:repl alias) and turned off for other tasks.
(doc-template desc args return)
args
argument list.desc
- String with description what function do.
args
- vector of symbols (argument names).
return
- String with description what function return.# Generate doc string template for given `args` argument list. * Params: **`desc`** - _String_ with description what function do. **`args`** - _vector_ of symbols (argument names). **`return`** - _String_ with description what function return. * Returns: _String_ as doc string template.
(global-exception-hook)
Params: no params.
Returns: nil
# Sets global exception hook to catch any uncaught exceptions and log it. * Params: no params. * Returns: _nil_
(if-let* bindings then)
(if-let* bindings then else)
Params:
bindings
- normal let bindings.
then
- S-form which will be evaluated if all bindings not nil.
else
- S-form which will be evaluated if one of bindings is nil. If else
is absent then return nil.
Returns:
value - any value which then
or else
produces.
Example: (if-let* [a 1 b 2 c 3 ] (+ a b c) :some-has-nil)
# Multiple binding version of if-let. * Params: **`bindings`** - normal let bindings. **`then`** - S-form which will be evaluated if all bindings not nil. **`else`** - S-form which will be evaluated if one of bindings is nil. If `else` is absent then return _nil_. * Returns: _value_ - any value which `then` or `else` produces. Example: (if-let* [a 1 b 2 c 3 ] (+ a b c) :some-has-nil)
(jce-unlimited?)
Params: no params.
Returns: true - JVM has unlimited cryptography strength. false - JVM has unsecured cryptography (NOT FOR PRODUCTION).
# Checks if JVM has unlimited cryptography strength. * Params: no params. * Returns: _true_ - JVM has unlimited cryptography strength. _false_ - JVM has unsecured cryptography (NOT FOR PRODUCTION).
(nif-let bindings & body)
If a binding is nil or false, evaluates its else-expr
form and stops there.
else-expr
is otherwise not evaluated.
Params:
bindings
- is two S-exp: binding-form else-expr
Returns:
value - any value which let block returns or else-expr
where nil/false is occurred.
Taken from here: https://www.proofbyexample.com/nested-if-let-in-clojure.html
Example: (nif-let [a x :a-is-nil b y :b-is-nil c z :c-is-nil d w :d-is-nil] (+ a b c d))
# Nested if-let. If all bindings are non-nil or true, executes body in the context of those bindings. If a binding is nil or false, evaluates its `else-expr` form and stops there. `else-expr` is otherwise not evaluated. * Params: **`bindings`** - is two S-exp: binding-form else-expr * Returns: _value_ - any value which let block returns or `else-expr` where nil/false is occurred. Taken from here: https://www.proofbyexample.com/nested-if-let-in-clojure.html Example: (nif-let [a x :a-is-nil b y :b-is-nil c z :c-is-nil d w :d-is-nil] (+ a b c d))
(obfuscate-map obj)
obfuscate values in map with sensitive data on all levels. map must contain meta data with :secrets key and vector of keywords which should be obfuscated as value. Example: (with-meta {:abc 123 :pwd "secret" :eee {:ssn 12345}} {:secrets [:pwd :ssn]}) return map of the same structure with obfuscated sensitive data on all levels. Example: {:abc 123 :pwd "obfuscated" :eee {:ssn 0}}
obfuscate values in map with sensitive data on all levels. map must contain meta data with :secrets key and vector of keywords which should be obfuscated as value. Example: (with-meta {:abc 123 :pwd "secret" :eee {:ssn 12345}} {:secrets [:pwd :ssn]}) return map of the same structure with obfuscated sensitive data on all levels. Example: {:abc 123 :pwd "*obfuscated*" :eee {:ssn 0}}
(project-build-time)
Params: no params.
Returns: String - current date and time in format dd MMMM YYYY, HH:mm:ss.
# Get current date and time as string. * Params: no params. * Returns: _String_ - current date and time in format dd MMMM YYYY, HH:mm:ss.
(project-version project-name)
Params:
project-name
- String name of project without ns.
Example: (project-version "util")
Returns: String - current version of project.
# Get current project version from Leiningen project using System properites. * Params: **`project-name`** - _String_ name of project without ns. * Example: (project-version "util") * Returns: _String_ - current version of project.
(safe bindings? & forms)
Params: any number of S-exp.
Returns: value - any value if success. nil - if got Exception
# Execute any S-expressions inside try-catch block. * Params: any number of S-exp. * Returns: _value_ - any value if success. _nil_ - if got Exception
(safe-log & forms)
Params:
forms
- any number of S-exp.
Returns: value - any value if success. nil - if got Exception and log it.
# Execute any S-expressions inside try-catch block. * Params: **`forms`** - any number of S-exp. * Returns: _value_ - any value if success. _nil_ - if got Exception and log it.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close