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
;; play with the latest | |
lein try metosin/ring-swagger | |
; nREPL server started on port 63138 on host 127.0.0.1 | |
; REPL-y 0.3.0 | |
; Clojure 1.5.1 | |
; Docs: (doc function-name-here) | |
; (find-doc "part-of-name-here") | |
; Source: (source function-name-here) | |
; Javadoc: (javadoc java-object-or-class-here) |
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
lein repl | |
;; nREPL server started on port 50058 on host 127.0.0.1 | |
;; REPL-y 0.3.0 | |
;; Clojure 1.5.1 | |
;; Docs: (doc function-name-here) | |
;; (find-doc "part-of-name-here") | |
;; Source: (source function-name-here) | |
;; Javadoc: (javadoc java-object-or-class-here) | |
;; Exit: Control+D or (exit) or (quit) | |
;; Results: Stored in vars *1, *2, *3, an exception in *e |
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 '[schema.core :as s]) | |
(require '[plumbing.core :refer :all]) | |
(defn path-vals | |
"Returns vector of tuples containing path vector to the value and the value." | |
[m] | |
(letfn | |
[(pvals [l p m] | |
(reduce | |
(fn [l [k v]] |
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
lein try metosin/ring-swagger | |
;nREPL server started on port 62925 on host 127.0.0.1 | |
;REPL-y 0.3.0 | |
;Clojure 1.5.1 | |
user=> (require '[ring.swagger.schema :refer :all]) | |
nil | |
user=> (defmodel Neiti {:aika org.joda.time.LocalDate}) |
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
lein try clj-http | |
; nREPL server started on port 64184 on host 127.0.0.1 | |
; REPL-y 0.3.0 | |
;Clojure 1.5.1 | |
; Tommi's awesome REPL | |
(require '[clj-http.client :as client]) | |
(defn random-names [n] | |
(->> (client/get "http://api.randomuser.me/" {:query-params {:results n :seed "kikkakakkakukka"} :as :json}) |
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 headers.handler | |
(:require [compojure.api.sweet :refer :all] | |
[ring.util.http-response :refer :all])) | |
;; | |
;; Create and register a new meta-data handler for compojure-api | |
;; | |
(require '[compojure.api.meta :as meta]) | |
(defmethod meta/restructure-param :header-params [_ header-params acc] |
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 '[schema.core :as s]) | |
;; nil | |
(defn form [m] {:pw1 String :pw2 (s/both String (s/eq (:pw1 m)))}) | |
;; #'user/form | |
(let [m {:pw1 "kikka" :pw2 "kikka"}] (s/check (form m) m)) | |
;; nil | |
(let [m {:pw1 "kikka" :pw2 "kukka"}] (s/check (form m) m)) |
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 xyz.server | |
(:require [org.httpkit.server :as server] | |
[ring.util.http-response :refer :all]) | |
(:gen-class)) | |
(defn app [req] (ok "hello world")) | |
(defn -main [] | |
(server/run-server app {:port 8080})) |
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
$ lein try camel-snake-kebab | |
(require '[camel-snake-kebab.core :as kebab]) | |
(require '[clojure.walk :as walk]) | |
(defn postwalk-keywords [f form] | |
(walk/postwalk #(if (keyword? %) (f %) %) form)) | |
(postwalk-keywords kebab/->kebab-case {[:f_o_o] :a_b :b_a_r {:b_a_z {:y_z #{'([:y_e_s])}}}}) | |
; {:b-a-r {:b-a-z {:y-z #{([:y-e-s])}}}, [:f-o-o] :a-b} |
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
{:user {:aliases {"eval" ["run" "-m" "clojure.main/main" "-e"]} | |
:dependencies [[org.clojure/tools.namespace "0.2.6"] | |
[aprint "0.1.0"] | |
[alembic "0.2.1"] | |
[im.chit/vinyasa "0.2.2"]] | |
:injections [(require '[vinyasa.inject :as inject]) | |
(inject/in | |
[vinyasa.inject inject] | |
[vinyasa.pull pull] |
OlderNewer