Skip to content

Instantly share code, notes, and snippets.

@guilespi
guilespi / memo.md
Created April 1, 2014 18:08 — forked from yokolet/memo.md
(defn validate-mappings
"Validates each mapped import is for an
existent field in the specified company"
[fields headers mappings]
(letfn [(found? [list element] (< (.indexOf list element) 0))]
(filter (fn [[header field]]
(or (found? headers header)
(found? fields field)))
mappings)))
;; Datomic example code
(use '[datomic.api :only (db q) :as d])
;; ?answer binds a scalar
(q '[:find ?answer :in ?answer]
42)
;; of course you can bind more than one of anything
(q '[:find ?last ?first :in ?last ?first]
"Doe" "John")
(defmethod validation/valid-field? :document-MX
[{value :value}]
(let [match (re-find #"(?i)(^[a-z]{2})([a-z])([a-z])(\d{6})(H|M)([a-z]{2})([a-z]{3})(\d{2})$" value)]
match))
(defmethod validation/valid-field? :document-UY
[{value :value}]
(when-let [[_ number digit] (re-find #"^(\d{7})-(\d)$" value)]
(let [m [2 9 8 7 6 3 4]
c (map #(utils/str->int (str %)) number)
@guilespi
guilespi / README.md
Created July 26, 2022 13:10 — forked from maxious/README.md
Esee/Anran 960P 180° Wireless Fisheye Panoramic CCTV Smart Camera HD WIFI Webcam IP