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 compare-jobs | |
| [m1 m2 key] | |
| (loop [keys (clojure.set/intersection (set (keys m1)) (set (keys m2))) | |
| changed-jobs {}] | |
| (if (empty? keys) | |
| changed-jobs | |
| (let [name (first keys) | |
| status (get-in m1 [name key]) | |
| updated-status (get-in m2 [name key])] | |
| (if (= status updated-status) |
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 gcd [a b] | |
| (let [min (min a b) | |
| max (max a b) | |
| rem (mod max min)] | |
| (if (zero? rem) | |
| min | |
| (recur min rem)))) | |
| (defn gcd2 [a b] | |
| (let [quotient (/ a b)] |
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
| (fn [s n] | |
| (keep-indexed | |
| (fn [i v] (when (pos? (mod (inc i) n)) v)) | |
| s)) |
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
| (= "Test Testerson, 123 Test Lane, Testerville, TX" | |
| (let [[a b] ["Test" "Testerson"] | |
| {:keys [street-address city state]} test-address] | |
| (str a " " b ", " street-address ", " city ", " state))) |
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
| (use 'clojure.java.io) | |
| (defn read-lines [file] | |
| (with-open [rdr (reader file)] | |
| (doall (line-seq rdr)))) | |
| (defn dna-reverse-complement [dna] | |
| "Takes a DNA string and returns it's reverse complement" | |
| (apply str (map (fn [x] | |
| (cond |
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
| #!/bin/bash | |
| get-infoq-video () { | |
| echo 'usage get-infoq-video http://www.infoq.com/presentations/Concurrency-Clojure' | |
| curl -A "Mozilla/5.0 (iPad; U; CPU OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mobile/7B334b Safari/531.21.10')" $1 | grep "<source src=" |sed -E 's/.*<source src="([^"]+)".*/\1/g' |xargs curl -O | |
| } |
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 epam-auth.core | |
| (:import (com.gargoylesoftware.htmlunit WebClient)) | |
| (:gen-class :main true))) | |
| (def client (doto (WebClient.) | |
| (.setUseInsecureSSL true) | |
| (.setJavaScriptEnabled true))) | |
| (defn login-form [] | |
| (let [page (.getPage client "http://duckduckgo.com") |
NewerOlder