(dissoc-empty-val m)
Remove all entries with nil or empty val
Remove all entries with nil or empty val
(dissoc-nil-val m)
Remove all entries with nil val
Remove all entries with nil val
(get-apk-meta-info apk & [select-keys])
Get meta info as a seq of map from an apk. Requires aapt command on
Linux system. select-keys
is vector which can be used to filter
entries to be returned.
Get meta info as a seq of map from an apk. Requires aapt command on Linux system. `select-keys` is vector which can be used to filter entries to be returned.
(get-time-as-string time-millis
&
{:keys [format timezone]
:or {format "yyyy/MM/dd HH:mm:ss" timezone "GMT+8"}})
Convert epoch time in millis to string by wrapping around
SimpleDateFormat. timezone
should be like GMT-8
or GMT+8
.
Note that if no timezone
is specified, GMT+8 will be employed.
Convert epoch time in millis to string by wrapping around SimpleDateFormat. `timezone` should be like `GMT-8` or `GMT+8`. Note that if no `timezone` is specified, GMT+8 will be employed.
(if-and-let bindings then-clause)
(if-and-let bindings then-clause else-clause)
Like if-let, but with multiple bindings allowed. If all of the expressions in the bindings evaluate truthy, the then-clause is executed with all of the bindings in effect. If any of the expressions evaluates falsey,evaluation of the remaining binding exprs is not done, and the else-clause is executed with none of the bindings in effect. If else-clause is omitted, evaluates to nil if any of the binding expressions evaluates falsey. As with normal let bindings, each binding is available in the subsequent bindings. (if-and-let [a (get my-map :thing) b (do-thing-with a)] ...) is legal, and will not throw a null pointer exception if my-map lacks a :thing key and (do-thing-with nil) would throw an NPE. If there's something you want to be part of the then-clause's condition,but whose value you don't care about, including a binding of it to _ is more compact than nesting yet another if inside the then-clause. Example: (if-and-let [x (:a {:a 42}) y (first [(/ x 3)])] [x y] :nothing)
Like if-let, but with multiple bindings allowed. If all of the expressions in the bindings evaluate truthy, the then-clause is executed with all of the bindings in effect. If any of the expressions evaluates falsey,evaluation of the remaining binding exprs is not done, and the else-clause is executed with none of the bindings in effect. If else-clause is omitted, evaluates to nil if any of the binding expressions evaluates falsey. As with normal let bindings, each binding is available in the subsequent bindings. (if-and-let [a (get my-map :thing) b (do-thing-with a)] ...) is legal, and will not throw a null pointer exception if my-map lacks a :thing key and (do-thing-with nil) would throw an NPE. If there's something you want to be part of the then-clause's condition,but whose value you don't care about, including a binding of it to _ is more compact than nesting yet another if inside the then-clause. Example: (if-and-let [x (:a {:a 42}) y (first [(/ x 3)])] [x y] :nothing)
(if-and-let* bindings then-clause else-clause deshadower)
(lowercase-trim str)
Convert to lowercase and trim. Returns nil if any exception occurs.
Convert to lowercase and trim. Returns nil if any exception occurs.
(maybe-vals->int m)
Convert all values in a map to number if possible.
Convert all values in a map to number if possible.
(now-millis)
(now-nanos)
(num= & args)
Returns true if every argument is approximately equal. Converts string to number automatically.
Returns true if every argument is approximately equal. Converts string to number automatically.
(rand-ints n)
Return a string with n
random digits
Return a string with `n` random digits
(str->num n)
String to number. If input is already a number, returns itself. Returns nil if input is not a number.
String to number. If input is already a number, returns itself. Returns nil if input is not a number.
(super-of? p c)
Determines if p
is a super class/interface of c
.
Usage
(super-of? Throwable (.getClass e#))
Determines if `p` is a super class/interface of `c`. Usage `(super-of? Throwable (.getClass e#))`
(trim input)
Trims a string, returns nil if the string is blank.
Trims a string, returns nil if the string is blank.
(wrap-exception func & [call-back])
Wrap exception with an optional call-back
function.
The call-back function accepts the exception e
and
the inputs of func
as args. Returns nil if no
call-back is provide.
Wrap exception with an optional `call-back` function. The call-back function accepts the exception `e` and the inputs of `func` as args. Returns nil if no call-back is provide.
(wrap-nil-on-error & body)
Eval (list* func args) in a try catch block. If any error is caught, returns nil
Eval (list* func args) in a try catch block. If any error is caught, returns nil
(wrap-time f)
(wrap-time key f)
Returns a wrapped function of the original, logs execution time of this function if :enable-time-logging is enabled.
Returns a wrapped function of the original, logs execution time of this function if :enable-time-logging is enabled.
(zip-str s)
convenience function to parse xml string as clojure datastructure, first seen at nakkaya.com later in clj.zip src
convenience function to parse xml string as clojure datastructure, first seen at nakkaya.com later in clj.zip src
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close