Skip to content

Instantly share code, notes, and snippets.

(defmacro afor
"Like for but eagerly builds a JS array.
Usually for react consumption."
[[item coll] & body]
`(reduce (fn [neue# ~item]
(.push neue# (do ~@body))
neue#)
(cljs.core/array) ~coll))
(defmacro arfor
@jcouyang
jcouyang / stop-asking.el
Last active June 29, 2020 14:01
disable emacs asking following git symbolink
; 当要打开一个symbolink的时候,如果symbollink到一个被git(或者其他vc)管理的文件时,emacs老问
; Symbolic link to Git-controlled source file; follow link? (y or n)
; 配置下这个变量就好了
(setq vc-follow-symlinks nil)
; nil 表示 不要问,no
; ask 表示每次都问
; t 表示follow
@alandipert
alandipert / maptemplate.md
Created January 30, 2013 00:28
ClojureScript macros: kinda, sorta, not really.

ClojureScript macros: kinda, sorta, not really.

ClojureScript does not have a standalone macro system. To write ClojureScript macros, one must write them in Clojure and then refer to them in ClojureScript code. This situation is workable, but at a minimum it forces one to keep ClojureScript code and the macros it invokes in separate files. I miss the locality of regular Clojure macros, so I wrote something called maptemplate that gives me back some of what I miss. The technique may be useful in other scenarios.

Problem

Suppose you're wrapping functionality in another namespace or package so that you can have your own namespace of identically named but otherwise decorated functions:

ClojureScript: