This file contains hidden or 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=> (require 'capra.account) | |
| nil | |
| user=> (capra.account/register "jbloggs" "jbloggs@example.com") | |
| nil |
This file contains hidden or 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=> (require 'capra.package) | |
| nil | |
| user=> (capra.package/create | |
| {:account "jbloggs" | |
| :name "hello-world" | |
| :version "1.0" | |
| :description "Hello World!" | |
| :files ["./build/hello-world.jar"]}) | |
| >> Uploading... | |
| >> Done. |
This file contains hidden or 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 wrap-session [handler options] | |
| (let [cookie (options :cookie-name "ring-session")] | |
| (wrap-cookies | |
| (fn [request] | |
| (let [session-key (get-in request [:cookies cookie :value]) | |
| session (atom (read-session session-key options)) | |
| request (assoc request :session session) | |
| response (handler request) | |
| new-session-key (if @session | |
| (write-session @session options) |
This file contains hidden or 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 hello-world | |
| (:use compojure.core | |
| ring.util.response | |
| ring.adapter.jetty)) | |
| (defroutes main-routes | |
| (GET "/" [] | |
| "Hello World") | |
| (ANY "*" [] | |
| (page-not-found))) |
This file contains hidden or 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 benchmark | |
| (:require [hiccup.core :as hiccup] | |
| [clj-html.core :as clj-html])) | |
| (defn clj-html-benchmark [] | |
| (let [text "Some text"] | |
| (clj-html/html | |
| [:html | |
| [:head | |
| [:title "Literal String"]] |
This file contains hidden or 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 hello-world [request] | |
| {:status 200 | |
| :headers {"Content-Type" "text/plain"} | |
| :body "Hello World"}) |
This file contains hidden or 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
| (defproject hello-world "1.0.0-SNAPSHOT" | |
| :description "FIXME: write" | |
| :dependencies [[org.clojure/clojure "1.1.0"] | |
| [org.clojure/clojure-contrib "1.1.0"] | |
| [compojure "0.4.0-SNAPSHOT"] | |
| [ring/ring-jetty-adapter "0.2.0"]]) |
This file contains hidden or 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
| (defproject post-example "1.0.0-SNAPSHOT" | |
| :description "FIXME: write" | |
| :dependencies [[org.clojure/clojure "1.1.0"] | |
| [org.clojure/clojure-contrib "1.1.0"] | |
| [compojure "0.4.0-SNAPSHOT"] | |
| [hiccup "0.2.3"] | |
| [ring/ring-jetty-adapter "0.2.0"]]) |
This file contains hidden or 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 testing.core | |
| (:use compojure.core | |
| [hiccup core form-helpers page-helpers]) | |
| (:require [compojure.route :as route])) | |
| (defn view-layout [& content] | |
| (xhtml {:lang "en"} | |
| [:head [:title "Datum"]] | |
| [:body content])) |
This file contains hidden or 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
| ;; When executed, this file will run a basic web server | |
| ;; on http://localhost:8080 that will display the text | |
| ;; 'Hello World'. | |
| (ns ring.example.hello-world | |
| (:use ring.adapter.jetty)) | |
| (defn handler [request] | |
| {:status 200 | |
| :headers {"Content-Type" "text/plain"} |