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
| ;; Let's you do this: | |
| ;; | |
| ;; (make-css | |
| ;; '(("body.loading" | |
| ;; (font-size "12px") | |
| ;; (color "#fff") | |
| ;; (" ul#sidenav" | |
| ;; (" li" | |
| ;; (blah "blah")))))) | |
| ;; |
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
| ;; | |
| ;; Sass in Scheme, Take 2 | |
| ;; Copyright 2011 Edwin Watkeys. All rights reserved. | |
| ;; | |
| ;; [Imagine the two-clause MIT license inserted here.] | |
| ;; | |
| ;; CSS can be a pain. There is apparently a tool called Sass that some | |
| ;; people use to deal with some of the issues that accompany non-trivial | |
| ;; applications of CSS. | |
| ;; |
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
| (define-syntax wes | |
| (syntax-rules () | |
| ((_ p s) | |
| (write-string s p)) | |
| ((_ p s t ...) | |
| (let ((nbytes (write-string s p))) | |
| (+ nbytes (wes p t ...)))))) |
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
| ;; | |
| ;; Sass in Scheme, Take 3 | |
| ;; Copyright 2011 Edwin Watkeys. All rights reserved. | |
| ;; | |
| ;; [Imagine the two-clause MIT license inserted here.] | |
| ;; | |
| ;; CSS can be a pain. There is apparently a tool called Sass that some | |
| ;; people use to deal with some of the issues that accompany non-trivial | |
| ;; applications of CSS. | |
| ;; |
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 foo | |
| (:use [clojure.contrib json])) | |
| (extend java.util.regex.Pattern | |
| json/Write-JSON | |
| {:write-json (fn [re w] (.write w (json-str (.pattern re))))}) |
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 cms.core | |
| (:use [clojure [pprint :only [pprint]]] | |
| [compojure core] | |
| [ring.adapter jetty] | |
| [ring.middleware reload stacktrace] | |
| [hiccup core page-helpers] | |
| [clojure.contrib json] | |
| [aleph redis] | |
| [lamina core]) | |
| (:require [compojure [route :as route]]) |
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
| bash-3.2$ lein deps | |
| Retrieving org/mongodb/mongo-java-driver/2.6.5/mongo-java-driver-2.6.5.pom (1k) | |
| from http://repo1.maven.org/maven2/ | |
| Could not transfer artifact org.mongodb:mongo-java-driver:pom:2.6.5 from/to central (http://repo1.maven.org/maven2): Checksum validation failed, no checksums available from the repository | |
| Could not find artifact org.mongodb:mongo-java-driver:pom:2.6.5 in clojars (https://clojars.org/repo/) | |
| Failed to collect dependencies for clojure.lang.LazySeq@5f8ab865 |
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 pick-and-rename [col pick-map] | |
| (def undefined-value (atom :undefined-value)) | |
| (apply assoc | |
| {} | |
| (flatten | |
| (filter (fn [[k v]] | |
| (not (= v undefined-value))) | |
| (map (fn [[k v]] | |
| [v (get col k undefined-value)]) | |
| pick-map))))) |
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
| ;; MACRO -*> | |
| ;; | |
| ;; While writing Ring handlers and other sorts of code that take advantage of | |
| ;; the threading idiom, it is often useful to peer inside the values of a thread | |
| ;; of evaluation. A :run condition is introduced here, which is evaluated | |
| ;; (presumably for side effects) before each form. Due to the nature of the | |
| ;; threading idiom, you must specify an EXPR-SYM, which is the symbol which is | |
| ;; used in the run and pre condition forms to specify the incoming value of the | |
| ;; first parameter. Additional parameters are not accessible. |
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
| (defun pbcopy (start end) | |
| ;; Useful for when you're doing 'emacs -nw' and you can't select | |
| ;; text in Terminal.app because you've split the terminal with | |
| ;; multiple buffers visible. | |
| (interactive "rSend region to OS X pasteboard:") | |
| (shell-command-on-region start end "pbcopy")) |