Starting from:
lein new foo
cd foo
Say I have a random JAR file that is not available in any repository:
touch README.md
; STM history stress-test | |
(defn stress [hmin hmax] | |
(let [r (ref 0 :min-history hmin :max-history hmax) | |
slow-tries (atom 0)] | |
(future | |
(dosync | |
(swap! slow-tries inc) | |
(Thread/sleep 200) | |
@r) |
{ | |
"_links": { | |
"self": { "href": "/orders" }, | |
"next": { "href": "/orders?page=2" }, | |
"find": { "href": "/orders{?id}", "templated": true } | |
}, | |
"_embedded": { | |
"orders": [{ | |
"_links": { | |
"self": { "href": "/orders/123" }, |
(ns my-cljs.macros.debug | |
(:require [cljs.analyzer :as cljs] | |
clojure.walk)) | |
(declare ap | |
cljs-macroexpand* | |
cljs-macroexpand-1* | |
cljs-macroexpand-all* | |
cljs-macroexpand |
App configuration in environment variables: for and against | |
For (some of these as per the 12 factor principles) | |
1) they are are easy to change between deploys without changing any code | |
2) unlike config files, there is little chance of them being checked | |
into the code repo accidentally | |
3) unlike custom config files, or other config mechanisms such as Java |
This describes how I setup Atom for an ideal Clojure development workflow. This fixes indentation on newlines, handles parentheses, etc. The keybinding settings for enter (in keymap.cson) are important to get proper newlines with indentation at the right level. There are other helpers in init.coffee and keymap.cson that are useful for cutting, copying, pasting, deleting, and indenting Lisp expressions.
The Atom documentation is excellent. It's highly worth reading the flight manual.
A list of commonly asked questions, design decisions, reasons why Clojure is the way it is as they were answered directly by Rich (even when from many years ago, those answers are pretty much valid today!). Feel free to point friends and colleagues here next time they ask (again). Answers are pasted verbatim (I've made small adjustments for readibility, but never changed a sentence) from mailing lists, articles, chats.
How to use:
# inspired by https://gist.github.com/sberryman/6770363f02336af82cb175a83b79de33 | |
FROM bvlc/caffe:gpu | |
RUN apt-get update -y && apt-get --assume-yes install \ | |
build-essential unzip \ | |
# General dependencies | |
libatlas-base-dev libprotobuf-dev libleveldb-dev libsnappy-dev libhdf5-serial-dev protobuf-compiler \ | |
libboost-all-dev \ | |
# Remaining dependencies, 14.04 | |
libgflags-dev libgoogle-glog-dev liblmdb-dev \ |
(ns fizz-buzz | |
"Approaching the infamous 'FizzBuzz' code problem with cyclic sequences and declarative rules") | |
;; SOLUTION | |
;; Core ideas: | |
;; 1. Note that the logic is essentially sequential and cyclical. | |
;; 2. Delay the actual computation (execution) by opting for lazy sequences. | |
;; 3. Separate control flow and logic, extracting the latter into a ruleset data structure. |