I hereby claim:
- I am weavejester on github.
- I am weavejester (https://keybase.io/weavejester) on keybase.
- I have a public key whose fingerprint is BADE B0BC BB50 10BB 9F4F F46A 87FC FC78 1A1B 513D
To claim this, I am signing this object:
| ;; I'd begin by using protocols to define the I/O boundaries of the endpoint. | |
| ;; The protocols can be extended to support the database and mailer component | |
| ;; when in production, and for testing a mock implementation can be used instead. | |
| (defprotocol UsersDatabase | |
| (authenticate [db credentials]) | |
| (create-user [db user])) | |
| (defprotocol Mailer | |
| (send-email [mailer email])) |
| (defun indent-or-complete () | |
| (interactive) | |
| (if (looking-at "\\_>") | |
| (company-complete-common) | |
| (indent-according-to-mode))) |
| (context "/" {{:keys [username]} :session} | |
| (GET "/foo" [link description] | |
| (do-something username link description))) |
| (require '[clojure.string :as str]) | |
| (defn parse-ints [line] | |
| (for [s (str/split line #" ")] (Integer/parseInt s))) | |
| (defn read-service-data [] | |
| (let [[n t] (parse-ints (read-line))] | |
| {:widths (parse-ints (read-line)) | |
| :tests (->> (repeatedly read-line) (take n) (map parse-ints))})) |
I hereby claim:
To claim this, I am signing this object:
| [[{:db/id #db/id[:db.part/tx] | |
| :db/txInstant #inst "2013-01-01T00:00:01Z"} | |
| {:db/id #db/id [:db.part/user] | |
| :db/ident :person/name | |
| :db/valueType :db.type/string | |
| :db/cardinality :db.cardinality/one | |
| :db.install/_attribute :db.part/db}]] |
| (ns reagi.core) | |
| (defn hello [] "Hello world") |
| user=> (austin-exec :src "src-cljs/") | |
| Browser-REPL ready @ http://localhost:54203/7624/repl/start | |
| WARNING: Symbol IDeref is not a protocol at line 3 /Users/jim/Development/reagi/src-cljs/reagi/core.cljs | |
| Type `:cljs/quit` to stop the ClojureScript REPL | |
| nil | |
| cljs.user=> (ns cljs.user (:require [reagi.core :as r])) | |
| nil |
| ;; No headers | |
| (resource :exists? get-data :handle-ok :data) | |
| ;; With a header | |
| (resource :exists? get-data | |
| :handle-ok (fn [context] | |
| (-> (rep/as-response (:data context) context) | |
| (header "Link" "<...>;rel=next")))) |
Let's assume we have a LESS resource we want to compile into a CSS resource before the end user sees it.
The response for the LESS resource might look something like this:
{:status 200
:headers
{"Content-Type" "text/less"
"Last-Modified" "Mon, 28 Oct 2013 21:23:08 GMT"}
:body