This is unmaintained, please visit Ben-PH/spacemacs-cheatsheet
SPC q q
- quitSPC w /
- split window verticallySPC w
- - split window horizontallySPC 1
- switch to window 1SPC 2
- switch to window 2SPC w c
- delete current window
Code: | |
(ns vararg-bench.core | |
(:require [criterium.core :refer [quick-bench]]) | |
(:gen-class)) | |
(defn varargs [arg1 & [arg2 arg3]] | |
42) |
# paste this into your console and hit enter | |
for voice in Agnes Kathy Princess Vicki Victoria Alex Bruce Fred Junior Ralph Albert Bad News Bahh Bells Boing Bubbles Cellos Deranged Good News Hysterical Pipe Organ Trinoids Whisper Zarvox; do say "Hi `whoami` my name is ${voice}" -v ${voice}; done |
This is unmaintained, please visit Ben-PH/spacemacs-cheatsheet
SPC q q
- quitSPC w /
- split window verticallySPC w
- - split window horizontallySPC 1
- switch to window 1SPC 2
- switch to window 2SPC w c
- delete current windowThis 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.
Benchmark code at: https://github.com/nathanmarz/specter/blob/master/scripts/benchmarks.clj | |
Run against Clojure 1.7.0 and Java 1.7.0 on Mac OSX 10.11.6 | |
Benchmark: get value in nested map (2500000 iterations) | |
Avg(ms) vs best Code | |
53.528 1.00 (-> data (get :a) (get :b) (get :c)) | |
54.708 1.02 (-> data :a :b :c) |
(ns clipboard.core | |
(:import (java.awt.datatransfer DataFlavor Transferable StringSelection) | |
(java.awt Toolkit))) | |
(defn get-clipboard | |
[] | |
(-> (Toolkit/getDefaultToolkit) | |
(.getSystemClipboard))) | |
(defn slurp-clipboard |
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:
(defn draw-ui [{:keys [label casing content]}] | |
(let [pad (Math/floor (/ (- (Math/max (count label) (count (or (:label content) ""))) | |
(+ 2 (Math/min (count label) (count (or (:label content) ""))))) | |
2))] | |
(println (str "|" (if (= :upper casing) | |
(.toUpperCase label) | |
(.toLowerCase label)) "|" \newline | |
"|" (reduce (fn [a b] (str a " ")) "" label) "|" \newline | |
(when content | |
(str "|" (apply str (repeat pad \space)) |
(defun giraffe () | |
"Passes a the active region (highlighted text in non-emacs | |
speak) to an external command that produces an SVG graph of the | |
data, which is then placed in a buffer called *giraffe* and | |
viewed as an image." | |
;; Declare that this is an interactive command. Whenever a function | |
;; starts this way emacs will make it available to be called with | |
;; M-x or bound to a key. | |
(interactive) |