Skip to content

Instantly share code, notes, and snippets.

@limist
limist / gist:5450982
Last active June 28, 2018 05:52
Web crawler example from the book "Clojure Programming"; the book's code has been modified with the imports (missing from book) needed to compile correctly, BUT the results of crawling look wrong, it seems only one URL is processed per agent(s), and then the agent(s) stops for the rest of the runtime.
(require '[net.cgrand.enlive-html :as enlive]) ; This line requires enlive 1.0.0
(use '[clojure.string :only (lower-case)])
(import '(java.net URL MalformedURLException))
;; The two imports below were not in the book, but essential for
;; subsequent code to work:
(use '[clojure.java.io :only (as-url)])
(import [java.util.concurrent BlockingQueue LinkedBlockingQueue])
;; Page 218:
(defn- links-from [base-url html]
@limist
limist / gist:4639239
Created January 26, 2013 00:40
Error output using org-mode 7.9.3d and current o-blog trunk, following clean-build instructions from `bug-report.html`
**Backtrace**
```
file-name-nondirectory(nil)
(or (and subtree-p (org-entry-get (region-beginning) "EXPORT_FILE_NAME" t)) (file-name-nondirectory buffer-file-name))
(file-name-sans-extension (or (and subtree-p (org-entry-get (region-beginning) "EXPORT_FILE_NAME" t)) (file-name-nondirectory buffer-file-name)))
(concat (file-name-sans-extension (or (and subtree-p (org-entry-get (region-beginning) "EXPORT_FILE_NAME" t)) (file-name-nondirectory buffer-file-name))) "." html-extension)
(expand-file-name (concat (file-name-sans-extension (or (and subtree-p (org-entry-get (region-beginning) "EXPORT_FILE_NAME" t)) (file-name-nondirectory buffer-file-name))) "." html-extension) (file-name-as-directory (or pub-dir (org-export-directory :html opt-plist))))
(if to-buffer nil (expand-file-name (concat (file-name-sans-extension (or (and subtree-p (org-entry-get (region-beginning) "EXPORT_FILE_NAME" t)) (file-name-nondirectory buffer-file-name))) "." html-extension) (file-name-as-directory (or pub-dir (org-expor