Skip to content

Instantly share code, notes, and snippets.

@devn
devn / lithp.rb
Created January 26, 2012 04:07 — forked from fogus/lithp.rb
class Lisp
def initialize
@env = {
:label => lambda { |(name,val), _| @env[name] = val },
:quote => lambda { |sexpr, _| sexpr[0] },
:car => lambda { |(list), _| list[0] },
:cdr => lambda { |(list), _| list.drop 1 },
:cons => lambda { |(e,cell), _| [e] + cell },
:eq => lambda { |(l,r), _| l == r },
:if => lambda { |(cond, thn, els), ctx| eval(cond, ctx) ? eval(thn, ctx) : eval(els, ctx) },
@devn
devn / gist:1624324
Created January 17, 2012 03:11
clojure and slime tweaks
;; Hide slime version mismatches
(setq slime-protocol-version 'ignore)
;; More syntax coloring
(defun tweak-clojure-syntax (mode)
(mapcar (lambda (x) (font-lock-add-keywords mode x))
'((("#?['`]*(\\|)" . 'clojure-parens))
(("#?\\^?{\\|}" . 'clojure-braces))
(("\\[\\|\\]" . 'clojure-brackets))
((":\\w+" . 'clojure-keyword))
@devn
devn / jquerytest.cljs
Created December 16, 2011 06:01 — forked from ryancrum/jquerytest.cljs
How to use jQuery from ClojureScript
(ns jquerytest.core)
(def jquery (js* "$"))
(jquery
(fn []
(-> (jquery "div.meat")
(.html "This is a test.")
(.append "<div>Look here!</div>"))))
@devn
devn / fm.clj
Created December 9, 2011 04:46 — forked from harold/fm.clj
(definst fm [carrier 440 divisor 2.0 depth 1.0]
(let [modulator (/ carrier divisor)
mod-env (env-gen (lin-env 1 0 1))
amp-env (env-gen (lin-env 0 1 1))]
(* amp-env
(sin-osc (+ carrier
(* mod-env (* carrier depth) (sin-osc modulator)))))))
; Some of these are more or less interesting
(fm)
Originally:
https://gist.github.com/7565976a89d5da1511ce
Hi Donald (and Martin),
Thanks for pinging me; it's nice to know Typesafe is keeping tabs on this, and I
appreciate the tone. This is a Yegge-long response, but given that you and
Martin are the two people best-situated to do anything about this, I'd rather
err on the side of giving you too much to think about. I realize I'm being very
critical of something in which you've invested a great deal (both financially
@devn
devn / org-remember-templates.el
Created November 29, 2011 16:41
org-remember-templates.el
(setq org-remember-templates
(quote
(("todo" ?t "* TODO %?\n %u\n %a" "~/Dropbox/org/gtd.org" bottom nil)
("note" ?n "* %?\n :NOTE:\n %u\n %a" "~/Dropbox/org/gtd.org" bottom nil)
("journal" ?j "* %U %?" "~/Dropbox/org/journal.org" 'top nil))))
@devn
devn / cannot recur across try.clj
Created November 21, 2011 05:24
Cannot recur across try
(defn property*
"The property* driver handles the work when testing a property. It
expects:
* a descriptive message for failure reporting
* a list of locals (also for reporting)
* a generator which takes the scaled size and returns the input
for the property
* the property test in form of a function of the generated
input."
{:added "2.0"}
@devn
devn / ascii-clojure-logo-3.txt
Created November 17, 2011 18:39
ascii clojure logo #3
qQQggggWWWWWWWBgggpQQ,
qggdWWWWWWWWWWWWWWWWWWWWWWWWgpQ,
QgWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWBpQ
QgWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWp,
\g#WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWBp
\gWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWBp
gWW"""\ 7"""WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWBp
" "W"" ""WWWWWWWWWWWWWWWWWWWk,
,,,, "WWWWWWWWWWWWWWWWWB,
QQQgggpQ, JEEEEEEEEENmqQ, "MWWWWWWWWWWWWWWWp
@devn
devn / clojure logo with sten.txt
Created November 17, 2011 18:35
clojure logo with "clojureclojure...clojure" stenography
.. .. .. .. .... .. . . .. . . ... . ... . . .. .. .. .. .. .... ..
. . .. . . ... . ... . . .. .. .. .. .. .... .. . . .. . . ... . ...
. . .. .. .. .. .. .... .. 8@8@88@8@8@888 . ... . . .. .. .. .. ..
.... .. . . .. . . ... .@@888@8@8@@88@88@@@88@@@88@.. .... .. . . .. . . ...
. ... . . .. .. .8@@@88@88@8888@88@@8@8@88@8@8@888@@. ... . . .. .. ..
.. .. .... .. . 8@88@8@8@888@@8@@888@8@8@@88@88@@@88@@@88o.. .... .. . . ..
. . ... . ... .@8@@88@88@@@88@@@88@88@8888@88@@8@8@88@8@8@888 . ... . . ..
.. .. .. .8@8888@88@@8@8@88@8@8@888@@8@@888@8@8@@88@88@@@88@@ .. .. .... ..
. . .. . . 888 . ... . .@@88@88@@@88@@@88@88@8888@88@@8@8@88@8@8 ... . ...
. . .. .. .. .. .. .... .c . . .. . . ... 8@@888@8@8@@88@88@@@.. .. ..
@devn
devn / clojure_logo.txt
Created November 17, 2011 18:31
ascii clojure logo
______________
,,--''::::::::::::::`-.___
,--'::::::::::::::::::::::::::`-._
,-'::::::::::::::::::::::::::::::::::`-.
,-'::::::::::::::::::::::::::::::::::::::::`.
,':::::::::::::::::::::::::::::::::::::::::::::`-.
,':__________:::::::::::::::::::::::::::::::::::::::\
/__/ `-._::________________::::::::::::::::::`.