Skip to content

Instantly share code, notes, and snippets.

(defn check-user
"Checks the nickname of the user. This functions as a basic authorization check for commands like \"!join\"."
[nick f]
(if (= nick "defn")
f
nil))
(def bot-fnmap
{:on-message
(fn [{:keys [nick channel message irc]}]
;; load paths
(setq dotfiles-dir (file-name-directory
(or (buffer-file-name) load-file-name)))
(add-to-list 'load-path dotfiles-dir)
(if (fboundp 'normal-top-level-add-subdirs-to-load-path)
(let* ((my-lisp-dir "~/.emacs.d/elpa-to-submit")
(default-directory my-lisp-dir))
(setq load-path (cons my-lisp-dir load-path))
file /Users/defn/bar.lua, init=flymake-lua-init
flymake is running: nil
file /Users/defn/bar.lua, init=flymake-lua-init [3 times]
saved buffer bar.lua in file /var/folders/VI/VIRffdZAEqWd-12ad4QFtE+++TI/-Tmp-/flymake82252q0R
started process 82456, command=(luac -p ../../var/folders/VI/VIRffdZAEqWd-12ad4QFtE+++TI/-Tmp-/flymake82252q0R), dir=/Users/defn/
received 122 byte(s) of output from process 82456
file /Users/defn/bar.lua, init=flymake-lua-init
parse line: file-idx=1 line-idx=2 file=/opt/local/bin/luac: ../../var/folders/VI/VIRffdZAEqWd-12ad4QFtE+++TI/-Tmp-/flymake82252q0R line=1 text=unexpected symbol near `{'
get-real-file-name: file-name=/opt/local/bin/luac: ../../var/folders/VI/VIRffdZAEqWd-12ad4QFtE+++TI/-Tmp-/flymake82252q0R real-name=/opt/local/bin/var/folders/VI/VIRffdZAEqWd-12ad4QFtE+++TI/-Tmp-/flymake82252q0R
parsed '/opt/local/bin/luac: ../../var/folders/VI/VIRffdZAEqWd-12ad4QFtE+++TI/-Tmp-/flymake82252q0R:1: unexpected symbol near `{'', got line-err-info
(defn format-code
[& codes]
(apply str (map
(fn [code]
(if (string? code)
(with-out-str
(pprint
(read
(java.io.PushbackReader.
(java.io.StringReader. code)))))))
07:54 -!- Irssi: Join to #wikipedia was synced in 1 secs
07:54 < defn> Hello all -- I was wondering if there has been any talk about including pronounciation in wiki articles.
07:54 < defn> I often find something like: http://en.wikipedia.org/wiki/Podwale,_Świętokrzyskie_Voivodeship , how does one pronounce
this?
07:55 < WikiziA62> Wikipedia EN can not be the scene of religious wars and persecution. This is against the pillars of the project. I
am outraged at what is happening. I ask for help to Wikimedia
07:55 < defn> If I wish to know I must consult another website.
07:55 < defn> WikiziA62: Welcome to the real world.
07:55 < defn> WikiziA62: It's an ugly, but idealism only takes us so far.
07:55 < defn> ugly place*
(defn application [text body]
(html
[:html
[:head
(include-js "/javascript/jquery.js"
"/javascript/syntaxhilighter/scripts/shCore.js"
"/javascript/syntaxhilighter/scripts/shBrushClojure.js"
"/javascript/application.js")
(include-css "/javascript/syntaxhilighter/styles/shCore.css"
"/javascript/syntaxhilighter/styles/shThemeDefault.css"
(def *enc-files-dir* "/home/blah/sandbox/enc")
(def *dec-files-dir* "/home/blah/sandbox/dec")
(defstruct file-map :filename :path :modified)
(defn #^{:doc "Return vec of file-maps"}
file-list [path]
(vec
(map (fn [n]
(struct-map file-map
(def file-info-extractors
{:filename #(.getName #^java.io.File %)
:path #(str (.toURI #^java.io.File %))
:modified #(.lastModified #^java.io.File %)})
(map #(reduce (fn [m [k e]]
(assoc m k (e %)))
{}
file-info-extractors)
(.listFiles (java.io.File. ".")))
(def tutorial-defn-1
(html
[:p.bottom "So, you wanna learn Clojure... Perhaps you're in it for the Lisp, or the JVM goodness. Perhaps you'd like to get your I/O on without a monad after a brief bout with Haskell. Perhaps you're a language nerd, the kind of guy who just finished up investigating Scala or Erlang. I regret to inform you that none of the above will be considered in the following tutorial. This tutorial has been systematically decoupled from theory, and is instead filled with garbage. Delicious, fragrant garbage. The kind of garbage that makes you stop and take a few more whiffs. It's like maple syrup...only more pungent. The trouble with this kind of garbage is that you never get to do anything with it. The garbage *you* need is the kind of garbage you can sink your feet into and wiggle your toes around. So, without further ado I present to you: The Most Garbage Tutorial Ever Conceived By A Dolphin."]
[:p.bottom "I know what you're thinking: \"This is ridiculous! Cloj
(defn markov-chain [index key]
"Lazily creates a markov chain"
(let [completion (markov-next index key)
next-key (nthrest (concat key completion) (count completion))]
(if (nil? completion)
'()
(lazy-cons (first completion) (markov-chain index next-key)))))