Skip to content

Instantly share code, notes, and snippets.

View p4ulcristian's full-sized avatar

Paul Martin Cristian p4ulcristian

View GitHub Profile
@philippkueng
philippkueng / core.clj
Created April 28, 2014 16:35
Fetch & write a binary file using Clojure and clj-http
(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))))
@maio
maio / deaccent.clj
Created December 26, 2014 13:06
Remove accent from string using Clojure
(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}+" "")))
@matthewdowney
matthewdowney / web3.clj
Created August 28, 2021 00:18
Call a smart contract from Clojure to query data from the Ethereum blockchain.
(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
@nhaantraan
nhaantraan / web3.clj
Created October 29, 2021 06:46 — forked from matthewdowney/web3.clj
Call a smart contract from Clojure to query data from the Ethereum blockchain.
(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