Skip to content

Instantly share code, notes, and snippets.

@Frozenlock
Frozenlock / gist:3026701
Created July 1, 2012 03:37
Export org document for Noir webserver
(defun my-org-html-export ()
"Export an org document to a .html file, without the preamble,
postamble and css. Also make sure the image path is compatible with Noir."
(interactive)
(let ((exported-html-file (concat (file-name-sans-extension (buffer-file-name)) ".html"))
(exported-html (org-export-as-html 3 nil nil 'string 'body-only)))
(with-temp-file exported-html-file
(insert exported-html)
(goto-char (point-min))
(replace-string "./" "/"))))
@Frozenlock
Frozenlock / insert-in-last-ielm-eval
Created June 16, 2012 15:57
Insert a string in the last return value in ielm
(defun insert-in-last-ielm-eval (string)
(when (search-backward "ELISP>" nil t)
(backward-char 1)
(newline)
(insert string)
(goto-char (point-max))))
@Frozenlock
Frozenlock / gist:2898908
Created June 9, 2012 00:53
Clojure: spit directly to zip
(defn spit-to-zip
"Put the content in filename and zip it into zip-filename. Accept
one or more filename/content."
[zip-filename filename content & others]
(with-open [zip (java.util.zip.ZipOutputStream.
(clojure.java.io/output-stream zip-filename))]
(let [add-entry (fn [name cont remain]
(-> zip (.putNextEntry (java.util.zip.ZipEntry. name)))
(doto (java.io.PrintStream. zip true)
(.println content))