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 split-from | |
"like split-at but with an offset. | |
Usage: | |
(split-from 5 7 (range 10)) --> | |
[(5 6 7) (8 9)] | |
" | |
[offset to s] | |
(split-at (- to (dec offset)) | |
(second (split-at offset s)))) |
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
18:35 *** rob`` JOIN | |
18:35 *** NAMES rob`` ckirkendall alexbaranosky cch1 SeanTAllen | |
duck1123 @devn | |
18:35 /part | |
18:35 *** rob`` PART #midje | |
18:36 *** rplevy JOIN | |
18:36 *** NAMES rplevy ckirkendall alexbaranosky cch1 SeanTAllen | |
duck1123 @devn | |
18:36 <ckirkendall> alexbaranosky: I haven't thought about | |
reporting at all yet. Still trying to get my |
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
(import 'java.util.UUID) | |
(defn uuid-gensym [& [prefix]] | |
(gensym (format "%suuid%s-" | |
(str (when prefix (str prefix "-"))) | |
(UUID/randomUUID)))) | |
(defmacro mk-var [to-bind] | |
`(def ~(uuid-gensym) ~to-bind)) |
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
(ns example | |
(:require [clojure-csv.core :as csv] | |
[swiss-arrows.core :refer [-<<]])) | |
(let [[headers rows] | |
((juxt (partial take 4) | |
(partial drop 4)) | |
(csv/parse-csv (slurp csv-file))))] | |
,,,) |
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
(defmacro qq [& body] | |
`(->> | |
(map (fn [s#] | |
(if (string? s#) | |
(format "\"%s\"" s#) (str s#))) | |
(quote ~body)) | |
(interpose " ") | |
(apply str))) | |
(defn myfn "docstring \"the normal way\" sort of a pain" [] ) |
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
(apply | |
format | |
"%d-%02d-%02d %02d:%02d:%02d" | |
(-< (doto (Calendar/getInstance) | |
(.setTime (Date. 112 4 17 14 15 0)) | |
(.add Calendar/MINUTE (* 15 offset))) | |
(.get Calendar/YEAR) | |
(.get Calendar/MONTH) | |
(.get Calendar/DAY_OF_MONTH) | |
(.get Calendar/HOUR) |
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
(defmacro with | |
"do things with the first expression passed, | |
and produce the result" | |
[expr & body] | |
`(let [~'% ~expr] ~@body)) | |
(defmacro within | |
"do things with the first expression passed (for side effects), | |
but produce the value of the first expression" | |
[expr & body] |
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 '[cemerick.pomegranate :refer [add-dependencies]]) | |
(add-dependencies | |
:coordinates '[[clj-http "0.6.3"] | |
[swiss-arrows "0.5.1"]] | |
:repositories {"clojars" "http://clojars.org/repo"}) | |
(require '[clj-http.client :as client] | |
'[swiss-arrows.core :refer [-<>]] | |
'[clojure.string :as str] | |
'[clojure.java.shell :refer [sh]]) |
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
;; 1. in checkouts dir, ln -s ../../clj-http . | |
;; 2. stick in clj-http.core/request: | |
(println | |
(str "curl -X" (.toUpperCase (name request-method)) " '" | |
(name scheme) "://" server-name ":" server-port uri | |
(or query-string "") | |
"' " | |
(reduce-kv (ƒ [r k v] | |
(str r " -H '" k ": " v "'")) "" headers) |
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
-----BEGIN PGP PUBLIC KEY BLOCK----- | |
Version: GnuPG/MacGPG2 v2.0.22 (Darwin) | |
Comment: GPGTools - https://gpgtools.org | |
mQINBFM0880BEADa1RfEdG6mtWuG/0eu1Ep9waegDOLuQ6VMcZbSAkIDMzes/eWa | |
5VjlekM1w0Ha92CfaZ0qKFk5NJjJTZzCWAVZGJsL8NZJPBr1CcTz5xXceGh+TP3N | |
6qCzUacyibuupoWGYzZjdbZEL5eX4ESzH5n3S6JmAx3Ih5YkZ5AU9bvrqd4iYtZT | |
DSfwY7U0SE1dJIy3ufuFbySbz7SlxUmwuh7VQqv9+VFT+uXE09CAWqy0EedwjH/L | |
mqnJV+N7m401BWlp3ec7Jd9suEbXm2JwimXCqGaA/0isOfkJgkSopj88NNlvEr2W | |
JNC6rOWicN4Lw+Gjmrnb7CH6tBM2sZEC9n0MiaabE6rK0dEs21c1GcIdWiDnfi9U |
OlderNewer