This file contains 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
#!/usr/bin/env bash | |
# Ensure this file is executable via `chmod a+x lein`, then place it | |
# somewhere on your $PATH, like ~/bin. The rest of Leiningen will be | |
# installed upon first run into the ~/.lein/self-installs directory. | |
export LEIN_VERSION="2.3.4" | |
case $LEIN_VERSION in | |
*SNAPSHOT) SNAPSHOT="YES" ;; |
This file contains 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
furtive.io.experimentation-platform> t* | |
"{\"applied-promo-ids\":[],\"merchant-id\":\"c4fdad7d-9139-fbb2-c78a-9597fcef487b\",\"order-id\":\"20140529T001014.287Z\",\"shipping-cost-in-cents\":3000,\"total-in-cents\":3658,\"shipping-method\":\"FEDEX_HOME\",\"cart-price-adjustments\":[],\"payment-method\":\"CREDIT_CARD\",\"page\":{\"url\":\"http://localhost:9000/site/c4fdad7d-9139-fbb2-c78a-9597fcef487b/purchase\",\"page-type\":\"CHECKOUT\",\"url-referrer\":\"http://localhost:9000/site/c4fdad7d-9139-fbb2-c78a-9597fcef487b/cart\",\"landing-url\":null,\"search-string\":null,\"search-refinement-types\":[]},\"generic\":{\"api-version\":1,\"meta\":{},\"client-request-id\":\"ebb753a1-fe76-4446-9195-5f29725b8bcb\"},\"runa-user-token\":\"7499b2e4-97ff-4b0a-afcd-a517f9520dd0\",\"cart-items\":[{\"number-of-reviews\":null,\"product-name\":\"Nestle® Pure Life® Bottled Purified Water, 16.9 oz. Bottles, 24/Case\",\"quantity\":1,\"sales-price-in-cents\":599,\"cost-of-good-in-cents\":null,\"categories\":[\"Drinks\",\"Food and Dri |
This file contains 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
{:type :purchase, | |
:coupon-code "23645378", | |
:cart | |
{:basket-id "567", | |
:order-id "978975", | |
:products | |
[{:list-price-cents 34500, | |
:merchant-product-id "1234", | |
:quantity 2, | |
:name "Pants,Jeans' 34\"", |
This file contains 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
(defn wrap-middleware-logging | |
([handler middlware-name] | |
(wrap-middleware-logging handler middlware-name false)) | |
([handler middlware-name summarize-and-log?] | |
(fn [req] | |
(tap (str middleware-name "-REQUEST") request) | |
(let [start (ts/now) | |
result (handler req) | |
end (ts/now) | |
result (if (map? result) ;; safety valve for legacy middlewares |
This file contains 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
(def ^:private default -1.0) | |
(def ^:private millis-in-a-day 86400000) |
This file contains 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
(def commonly-used-str->keyword | |
{"precise" :precise | |
"messy" :messy | |
"active" :active | |
"control" :control}) | |
(defn fast-keywordize [k] | |
(get commonly-used-str->keyword k)) | |
(defn third-way [k] |
This file contains 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
(eval-after-load "sql" | |
'(progn | |
(sql-set-product 'postgres))) | |
(add-hook 'sql-mode-hook 'sql-highlight-postgres-keywords) |
This file contains 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
;; interesting destructuring behavior I never took advantage of... | |
;; Wonder if it'd make destructuring faster to remove the seq? | |
;; checking stuff, which I did know anyone used, at least not explicitly | |
;; macroexpand: | |
(let [{:keys [a b] :as c} '(:a 1 :b 2) ] [a b c]) | |
;; => | |
(let* | |
[map__27061 |
This file contains 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
(defmacro let-map | |
"Creates a hash-map which can refer to the symbols of the names of the keys | |
declared above." | |
[& kvs] | |
(assert (even? (count kvs))) | |
(let [ks (take-nth 2 kvs) | |
sym-ks (map (comp symbol name) ks) | |
vs (take-nth 2 (rest kvs))] | |
`(let ~(vec (interleave sym-ks vs)) | |
~(apply hash-map (interleave ks sym-ks))))) |
This file contains 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
(->> (repeatedly (partial rand-int 26)) | |
(map #(+ % 65)) | |
(map char) | |
(take 100) | |
(apply str)) |