#VIM Shortcuts
##How to Exit
Command | Description |
---|---|
:q[uit] | Quit Vim. This fails when changes have been made. |
:q[uit]! | Quit without writing. |
:cq[uit] | Quit always, without writing. |
:wq | Write the current file and exit. |
(defn str->int | |
"Converts a string to an integer" | |
[string] | |
(Integer. (re-find #"\d+" string))) |
(defn contains-keys? | |
"True if all keys are contained within the map" | |
[maps keywords] | |
(let [map-list maps | |
all-keys keywords] | |
(if (empty? all-keys) | |
true | |
(if (contains? map-list (first all-keys)) | |
(recur map-list (rest all-keys)) | |
false)))) |
(defn key-with-value¬ | |
"Retrieves the first key that has the associated value" | |
[list-items value] | |
(first (filter (comp #{value} list-items) (keys list-items)))) |
(defn arraylist->map¬ | |
"Converts an arraylist java object to a list" | |
[al] | |
(loop [finished-list {} | |
counter 0] | |
(if (>= counter (.size al)) | |
finished-list | |
(recur (into finished-list (.get al counter)) | |
(inc counter))))) |
(defn stringmap->keymap | |
"Converts a map with strings as keys into a map with keywords" | |
[m] | |
(into {} | |
(for [[k v] m] | |
[(keyword k) v]))) |
<!doctype html> | |
<title>Site Maintenance</title> | |
<style> | |
body { text-align: center; padding: 150px; } | |
h1 { font-size: 50px; } | |
body { font: 20px Helvetica, sans-serif; color: #333; } | |
article { display: block; text-align: left; width: 650px; margin: 0 auto; } | |
a { color: #dc8100; text-decoration: none; } | |
a:hover { color: #333; text-decoration: none; } | |
</style> |
#VIM Shortcuts
##How to Exit
Command | Description |
---|---|
:q[uit] | Quit Vim. This fails when changes have been made. |
:q[uit]! | Quit without writing. |
:cq[uit] | Quit always, without writing. |
:wq | Write the current file and exit. |
(import 'java.security.MessageDigest | |
'java.math.BigInteger) | |
(defn md5 [s] | |
(let [algorithm (MessageDigest/getInstance "MD5") | |
size (* 2 (.getDigestLength algorithm)) | |
raw (.digest algorithm (.getBytes s)) | |
sig (.toString (BigInteger. 1 raw) 16) | |
padding (apply str (repeat (- size (count sig)) "0"))] | |
(str padding sig))) |
.passing { | |
background-color: #6EFF75; | |
} | |
.warning { | |
background-color: #E8C359; | |
} | |
.failed { | |
background-color: #FF4D4D; | |
} |