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 cljs-test.client) | |
(defn now [] | |
(. (js/Date.) (getTime))) | |
(let [nums (doall (range 0 1000000)) | |
start (now)] | |
(doseq [n nums] | |
) | |
(. js/console (log (str "pre-seq: " (- (now) start))))) |
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 '[noir.server :as server]) | |
(use 'noir.core 'aleph.http 'lamina.core) | |
(defn async-response [response-channel request] | |
(enqueue response-channel | |
{:status 200 | |
:headers {"content-type" "text/plain"} | |
:body "async response"})) | |
(defpage "/" [] "hey from Noir!") |
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
let vimclojure#HighlightBuiltins=1 | |
let vimclojure#HighlightContrib=1 | |
let vimclojure#DynamicHighlighting=1 | |
let vimclojure#ParenRainbow=1 | |
let vimclojure#WantNailgun = 1 | |
let vimclojure#NailgunClient = "/users/chris/.vim/bundle/vimclojure-2.3.0/lib/ng" |
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 irc | |
(:import (java.net Socket) | |
(java.io PrintWriter InputStreamReader BufferedReader)) | |
(:require 'clojure.contrib.duck-streams) | |
(:use [clj-time.core :only [in-secs interval epoch now]])) |
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
Exception in thread "main" java.lang.RuntimeException: java.lang.RuntimeException: java.lang.ClassCastException: clojure.lang.PersistentArrayMap cannot be cast to clojure.lang.Named (NO_SOURCE_FILE:0) | |
at clojure.lang.Compiler.eval(Compiler.java:5440) | |
at clojure.lang.Compiler.eval(Compiler.java:5391) | |
at clojure.core$eval.invoke(core.clj:2382) | |
at clojure.main$eval_opt.invoke(main.clj:235) | |
at clojure.main$initialize.invoke(main.clj:254) | |
at clojure.main$script_opt.invoke(main.clj:270) | |
at clojure.main$main.doInvoke(main.clj:354) | |
at clojure.lang.RestFn.invoke(RestFn.java:457) | |
at clojure.lang.Var.invoke(Var.java:377) |
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
(defmacro mainpage [route params & body] | |
`(defpage ~route ~params | |
(common/main-layout | |
~@body))) | |
;;Or if you wanted to get really crazy, so that you don't have to duplicate that macro | |
;;you could write a macro that writes the macros for you: | |
(defmacro layout-page [name layout] | |
`(defmacro ~name [route# params# & body#] |
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
(defpage "/blah/:n" {:keys [n]} | |
(session/put! :b n)) | |
(deftest session-vals | |
(with-noir | |
(session/put! :b 3) | |
(render "/blah/:n" {:n 1}) | |
(is (= (session/get :b) 1)))) |
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
(def my-dirs [:north :north :east :east :south :south :west :west]) | |
(defn moves [& dirs] | |
(doseq [d dirs] | |
(println "Moving:" d) | |
(move d))) | |
(apply moves my-dirs) |
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
(defproject lyrionch "0.1.0-SNAPSHOT" | |
:description "FIXME: write this!" | |
:dependencies [[org.clojure/clojure "1.3.0"] | |
[noir "1.2.2"] | |
[korma "0.2.1"] | |
[mysql/mysql-connector-java "5.1.18"]] | |
:ring {:handler lyrionch.server/handler} | |
:main lyrionch.server) |
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
<!doctype html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>CodeMirror: Active Line Demo</title> | |
<link rel="stylesheet" href="../lib/codemirror.css"> | |
<script src="../lib/codemirror.js"></script> | |
<script src="../mode/xml/xml.js"></script> | |
<link rel="stylesheet" href="../doc/docs.css"> |