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 hammock-cafe.ui.history | |
(:require [io.pedestal.app.protocols :as p] | |
[io.pedestal.app.util.log :as log] | |
[io.pedestal.app.messages :as msg])) | |
(def last-page (atom nil)) | |
(def dispatchers (atom {})) | |
(defn navigate [token] |
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
(def default-special-fns | |
(let [load-file-fn (fn [repl-env file] (load-file repl-env file))] | |
{'in-ns (fn [_ quoted-ns] (set! comp/*cljs-ns* (second quoted-ns))) | |
'load-file load-file-fn | |
'clojure.core/load-file load-file-fn | |
'load-namespace (fn [repl-env ns] (load-namespace repl-env ns))})) | |
(defn repl | |
"Note - repl will reload core.cljs every time, even if supplied old repl-env" | |
[repl-env & {:keys [verbose warn-on-undeclared special-fns]}] |
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 hack.queue) | |
(defn log [form] | |
(.log js/console (pr-str form))) | |
(defprotocol Queue | |
(pop [this]) | |
(empty? [this]) | |
(peek [this]) | |
(append [this x])) |
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
;; This is a clojure.test test case which enters a value in a form | |
;; field in the browser, clicks the submit button and checks that the | |
;; correct information is displayed in the page and that the client | |
;; and server state is as it should be. 'database' is an atom in the | |
;; server and 'state' is an atom in the browser. | |
(deftest test-enter-name | |
(reset! database #{}) | |
;; evaluate two forms in the browser in the start.view namespace | |
(cljs-eval start.view | |
(dom/set-value :name-input "Ted") |
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
;; ClojureScript Demo | |
;; ================== | |
(use 'cljs.closure) | |
;; ClojureScript compiler examples | |
(println (-compile '(defn add [a b] (+ a b)) {})) | |
(println (-compile '(defn add [& args] (reduce + args)) {})) |
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
(defform foo-form "/foo" | |
:fields [(hidden :id) | |
(hidden :remote-addr) | |
(textfield "Enter Your Foo" :foo)] | |
:on-cancel "/" | |
:on-success | |
#(do | |
(flash-put! :message (str %)) | |
"/") | |
:defaults (fn [request] |
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
{-# LANGUAGE TypeSynonymInstances #-} | |
class TwoOf a where | |
twoOf :: String -> a | |
instance TwoOf Bool where | |
twoOf str = length str >= 2 | |
instance TwoOf String where | |
twoOf str = take 2 str |
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=> (use 'leibniz.derivative) | |
nil | |
user=> (def y '(* (+ (* 3 ?x) 4) (+ (* 4 ?x) 6))) | |
#'user/y | |
user=> (def fy (f [?x] y)) | |
#'user/fy | |
user=> (fy 7) | |
850 | |
user=> (deriv y ?x) | |
(+ (* 24 ?x) 34) |
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
$(function() { | |
$("#hire-date").datepicker({dateFormat: 'yy-mm-dd'}); | |
$("#language").autocomplete({source: "langs-starting-with"}); | |
$("#name").blur(function() { | |
validateField("name"); | |
}); | |
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
div.sandbar-field { | |
position: relative; | |
} | |
div.sandbar-form div.error-message { | |
height: 24px; | |
padding-left: 24px; | |
background: url(../images/warning.png) no-repeat 4px -2px; | |
color: red; | |
vertical-align: bottom; |
NewerOlder