Skip to content

Instantly share code, notes, and snippets.

@zehnpaard
zehnpaard / simple-modular-ring.core.clj
Created October 28, 2016 06:07
Simple Ring Demo with Separate Modules and GET/POST forms
(ns simple-modular-ring.core
(require
[ring.adapter.jetty :refer [run-jetty]]
[simple-modular-ring.handler :as h]
[simple-modular-ring.middleware :as m]
))
(def app
(-> h/post-form
m/logger
@zehnpaard
zehnpaard / ring-with-routing.core.clj
Created October 29, 2016 13:32
Simple Ring Demo with Routing
(ns ring-with-routing.core
(require
[ring.adapter.jetty :refer [run-jetty]]
[ring-with-routing.handler :as h]
[ring-with-routing.middleware :as m]
))
(def app
(-> h/handler-with-routing
m/logger
@zehnpaard
zehnpaard / simple-compojure.core.clj
Created October 30, 2016 06:03
Simple Compojure Demo with GET/POST forms
(ns simple-compojure.core
(require
[ring.adapter.jetty :refer [run-jetty]]
[ring.middleware.params :as p]
[simple-compojure.middleware :as m]
[simple-compojure.routes :as r]
))
(def app
(-> r/routes
@zehnpaard
zehnpaard / simple-hiccup.core.clj
Last active March 25, 2023 02:04
Simple Ring/Compojure/Hiccup Demo
(ns simple-hiccup.core
(require
[ring.adapter.jetty :refer [run-jetty]]
[simple-hiccup.middleware :as m]
[simple-hiccup.routes :as r]
))
(def app
(-> r/routes
m/logger
@zehnpaard
zehnpaard / min-cljsbuild.core.cljs
Created November 5, 2016 00:26
Nearly Minimal Clojurescript Compilation with cljsbuild
(ns min-cljsbuild.core)
(js/alert "Hello ClojureScript!")
(ns try-cljsbuild.core)
(js/alert "Hello Clojurescript!")
@zehnpaard
zehnpaard / min-figwheel.core.cljs
Created November 8, 2016 12:16
Minimal Figwheel Project Structure
(ns min-figwheel.core)
(js/alert "Hello ClojureScript!")
@zehnpaard
zehnpaard / min-reagent.core.cljs
Created November 10, 2016 22:26
Minimal Reagent Project
(ns min-reagent.core
(:require
[reagent.core :as r]))
(defn my-app []
[:div
[:h1 "Hello Reagent"]
[:p "ClojureScript + React + Atoms + Hiccup"]])
(r/render
@zehnpaard
zehnpaard / react-tutorial.core.cljs
Last active November 16, 2016 08:21
Reagent port of initial state for official React tutorial code https://facebook.github.io/react/tutorial/tutorial.html
(ns react-tutorial.core
(:require
[reagent.core :as r]))
(defn Square []
[:button.square])
(defn Board []
(let [renderSquare (fn [i] [Square])
status (r/atom "Next player: X")]
@zehnpaard
zehnpaard / clicker.core.cljs
Created November 13, 2016 21:38
Reagent Form-2 Component Nesting (Purely Demonstrative Purposes)
(ns clicker.core
(:require [reagent.core :as r]))
(defn clicker []
(let [john? (r/atom true)]
(fn []
(let [clicks (r/atom 0)]
(fn []
[:div
[:h1 {:on-click #(swap! john? not)} (if @john? "John" "James")]