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
(ns web3 | |
"Call an Ethereum smart contract (Uniswap v2) from Clojure. | |
Requires https://github.com/clj-python/libpython-clj for python interop. Also | |
make sure to $ pip install web3." | |
(:require [libpython-clj2.python :as py] | |
[libpython-clj2.require :refer [require-python]])) | |
(comment ;; deps.edn |
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
(ns web3 | |
"Call an Ethereum smart contract (Uniswap v2) from Clojure. | |
Requires https://github.com/clj-python/libpython-clj for python interop. Also | |
make sure to $ pip install web3." | |
(:require [libpython-clj2.python :as py] | |
[libpython-clj2.require :refer [require-python]])) | |
(comment ;; deps.edn |
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
(defn deaccent [str] | |
"Remove accent from string" | |
;; http://www.matt-reid.co.uk/blog_post.php?id=69 | |
(let [normalized (java.text.Normalizer/normalize str java.text.Normalizer$Form/NFD)] | |
(clojure.string/replace normalized #"\p{InCombiningDiacriticalMarks}+" ""))) |
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
(ns the-namespace.core | |
(:require [clj-http.client :as client] | |
[clojure.java.io :as io])) | |
(defn- fetch-photo! | |
"makes an HTTP request and fetches the binary object" | |
[url] | |
(let [req (client/get url {:as :byte-array :throw-exceptions false})] | |
(if (= (:status req) 200) | |
(:body req)))) |