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
(alter-var-root | |
#'clojure.tools.logging/*logger-factory* | |
(constantly (clojure.tools.logging.impl/jul-factory))) |
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 https-url [request-url] | |
(str (str (str (str "https://" (:server-name request-url) ":") "443")) (:uri request-url))) | |
(defn require-https | |
[handler] | |
(fn [request] | |
(if (= (:scheme request) :http) | |
(ring.util.response/redirect (https-url request)) | |
(handler request)))) |
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
http://stackoverflow.com/questions/487258/plain-english-explanation-of-big-o | |
http://stackoverflow.com/questions/2307283/what-does-olog-n-mean-exactly/2307314#2307314 | |
http://compgeom.cs.uiuc.edu/~jeffe/teaching/algorithms/ |
- http://functionaljobs.com/ - Clojure jobs.
- http://www.awwwards.com/jobs/ - Seems like interesting Front-end projects.
- https://weworkremotely.com/
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
(:require [clj-time.format :as clj-time-format])) | |
(defn get-day [date-str] | |
(let [date (clj-time-format/parse (clj-time-format/formatter "YYYY-MM-dd") date-str) | |
day (clj-time-format/unparse (clj-time-format/formatter "EEEE") date)] | |
day)) | |
(get-day "2013-06-09") | |
"Monday" |
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 bubble-step [coll was-changed less?] | |
(if (second coll) | |
(let [[x1 x2 & xs] coll | |
is-less-than (less? x1 x2) | |
smaller (if is-less-than x1 x2) | |
larger (if is-less-than x2 x1) | |
is-changed (or was-changed (not is-less-than)) | |
[sorted is-sorted] (bubble-step (cons larger xs) is-changed less?)] | |
[(cons smaller sorted) is-sorted]) | |
[coll (not was-changed)])) |
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
var sumBTree = function(tree){ | |
if(!tree || tree.length == 0) return 0 | |
return tree[0] + sumBtree(tree[1]) + sumBtree(tree[2]) | |
} | |
var tree = [1, [2, [1], [6]], [3, [1]]] | |
sumBTree(tree) // 14 |
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
func insertionSort(data []int) []int { | |
for n := 1; n < len(data); n++ { | |
v := data[n] | |
for k:=n - 1; k >= 0; k-- { | |
if v < data[k] { | |
// swap | |
data[k+1] = data[k] | |
data[k] = v | |
} | |
} |
OlderNewer