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
/** | |
* Author: Hans Engel | |
* Branched from CodeMirror's Scheme mode (by Koh Zi Han, based on implementation by Koh Zi Chun) | |
*/ | |
CodeMirror.defineMode("clojure", function () { | |
var BUILTIN = "builtin", COMMENT = "comment", STRING = "string", CHAR = "char", | |
ATOM = "atom", NUMBER = "number", BRACKET = "bracket", KEYWORD = "keyword"; | |
var INDENT_WORD_SKIP = 2; | |
function makeKeywords(str) { |
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
(defn rel-map | |
[ent sub-ent type opts] | |
(assoc-in ent [:rel (:name sub-ent)] | |
(delay | |
(create-relation ent sub-ent type opts)))) | |
(defmacro has-one | |
"Add a has-one relationship for the given entity. It is assumed that the foreign key | |
is on the sub-entity with the format table_id: user.id = address.user_id | |
Opts can include a key for :fk to explicitly set the foreign key. |
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"> |
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
(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
(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
(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
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
(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
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" |