(defn- parse
"Parse years collection into years integer collection. Example: from ['1978' '1956' ...] to (1978 1956)"
[col*]
(map #(Integer/parseInt %) col*))
(defn- group-consecutive-years
"Example: from (2014 2010 2011 2012 2015 2016 2017) to ((2010 2011 2012) (2014 2015 2016 2017))"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (in-ns 'akvo.lumen.specs.aggregation) | |
| (def s* lumen.s/sample) | |
| (s* ::l.aggregation.filter/filter) | |
| ;; => {:operation "remove", | |
| ;; :strategy "isLower", | |
| ;; :value "3hrEm8YaB0ZxnuS", | |
| ;; :column | |
| ;; {:columnName "d3", |
Created from the plain text reference card on orgmode.org Download this file, and open it in Emacs org-mode!
Created from the plain text reference card on orgmode.org Download this file, and open it in Emacs org-mode!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| CREATE OR REPLACE FUNCTION history.log_change() RETURNS trigger AS $_$ | |
| DECLARE | |
| c refcursor; | |
| tt tstzrange; | |
| r record; | |
| str text; | |
| my_new text; | |
| BEGIN | |
| str := ''; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| java.lang.IllegalStateException: | |
| Attempt to remove an object from the bag that was not borrowed or reserved | |
| ConcurrentBag.java:207 com.zaxxer.hikari.util.ConcurrentBag.remove | |
| HikariPool.java:394 com.zaxxer.hikari.pool.HikariPool.closeConnection | |
| HikariPool.java:223 com.zaxxer.hikari.pool.HikariPool.releaseConnection | |
| ConnectionProxy.java:216 com.zaxxer.hikari.proxy.ConnectionProxy.close | |
| jdbc.clj:1014 clojure.java.jdbc/db-query-with-resultset* | |
| jdbc.clj:996 clojure.java.jdbc/db-query-with-resultset* | |
| jdbc.clj:1090 clojure.java.jdbc/query | |
| jdbc.clj:1047 clojure.java.jdbc/query |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ;; using docker-compose up, we loose the cider ability to navigate definitions with `C - .` due the source of current (docker) nrepl is under a different path `/app/src` instead of akvo-lumen local git repo | |
| ;; so the trick is to replace docker source paths by user-local-paths. | |
| ((nil . ((eval . (defun to-local-paths (info) | |
| "adapt src and .m2 docker paths to local paths" | |
| (let* ((file (nrepl-dict-get info "file")) | |
| (res-0 (progn | |
| (replace-regexp-in-string "/app/" (clojure-project-dir) file)))) | |
| (replace-regexp-in-string "/home/akvo/.m2/" | |
| (concat (getenv "HOME") "/.m2/") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (defun copy-current-line-position-to-clipboard () | |
| "Copy current line in file to clipboard as '</path/to/file>:<line-number>'" | |
| (interactive) | |
| (let ((path-with-line-number | |
| (concat (buffer-file-name) "::" (number-to-string (line-number-at-pos))))) | |
| (when path-with-line-number | |
| (with-temp-buffer | |
| (insert path-with-line-number) | |
| (clipboard-kill-region (point-min) (point-max))) | |
| (message (concat path-with-line-number " copied to clipboard"))))) |
Simply put, destructuring in Clojure is a way extract values from a datastructure and bind them to symbols, without having to explicitly traverse the datstructure. It allows for elegant and concise Clojure code.