When unsing docker compose you can have a problem with the order of dependent linked containers
The solution is to start a script which tries to access a service and waits until it gets ready before loading your program
(def tx-fns | |
[{:db/ident :db.fn/reset-attribute-values | |
:db/doc "Transaction function which accepts an entity identifier, attribute identifier | |
and set of values and expands to any additions and retractions necessary to | |
make the final post-transaction value of the attribute match the provided | |
values. Attribute values must be scalars. | |
If multiple values are provided on a cardinality-one attribute you will get a | |
datom conflict exception at transaction time." | |
:db/fn (d/function |
(def regex-char-esc-smap | |
(let [esc-chars "()&^%$#!?*."] | |
(zipmap esc-chars | |
(map #(str "\\" %) esc-chars)))) | |
(defn str-to-pattern | |
[string] | |
(->> string | |
(replace regex-char-esc-smap) | |
(reduce str) |
When unsing docker compose you can have a problem with the order of dependent linked containers
The solution is to start a script which tries to access a service and waits until it gets ready before loading your program
# Hello, and welcome to makefile basics. | |
# | |
# You will learn why `make` is so great, and why, despite its "weird" syntax, | |
# it is actually a highly expressive, efficient, and powerful way to build | |
# programs. | |
# | |
# Once you're done here, go to | |
# http://www.gnu.org/software/make/manual/make.html | |
# to learn SOOOO much more. |
(require '[clojure.core.async :as a]) | |
(def xform (comp (map inc) | |
(filter even?) | |
(dedupe) | |
(flatmap range) | |
(partition-all 3) | |
(partition-by #(< (apply + %) 7)) | |
(flatmap flatten) | |
(random-sample 1.0) |
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.
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
When hosting our web applications, we often have one public IP
address (i.e., an IP address visible to the outside world)
using which we want to host multiple web apps. For example, one
may wants to host three different web apps respectively for
example1.com
, example2.com
, and example1.com/images
on
the same machine using a single IP address.
How can we do that? Well, the good news is Internet browsers
;; REPL ONLY | |
;; Require clj-http https://github.com/dakrone/clj-http/ | |
(require '[clj-http.client :as client]) | |
;; Import Apache Common's Base64 encoder/decoder | |
(import (org.apache.commons.codec.binary Base64)) | |
(def test-file | |
;Image Credit Metropolitan Museum of Art | |
(client/get "http://images.metmuseum.org/CRDImages/ma/web-large/DP241865.jpg" {:as :byte-array})) |