Skip to content

Instantly share code, notes, and snippets.

@joekarma
joekarma / gist:4583848
Created January 21, 2013 05:37
Trying to run lispbuilder-sdl from a separate thread...
(bt:make-thread (lambda ()
(sdl:with-init ()
(sdl:window 1024 768)
(sdl:with-events ()
(:quit-event () t)
(:idle ()
(sdl:clear-display sdl:*black*)
(sdl:update-display))))))
@joekarma
joekarma / index.haml
Created December 6, 2012 04:51
A CodePen by Joe Taylor. Keyboard - A keyboard. Nothing much else to it. Not functional. Sloppily coded. More of a codepencil (sketchy) than a codepen.
#keyboard
@joekarma
joekarma / index.haml
Created November 29, 2012 07:01
A CodePen by Joe Taylor. CSS3 Hourglass - Hourglass (actually, minuteglass) animation using only CSS3 + HTML.
#hour-glass
#glass
#top-sand
#bottom-sand
@joekarma
joekarma / index.haml
Created November 27, 2012 07:35
A CodePen by Joe Taylor. CSS3 Add New Icon - Combined some simple CSS3 rules to create an "add new" icon with a fun little mouseover transition.
%span.add-new
@joekarma
joekarma / gist:4023804
Created November 6, 2012 09:59
Get list (actually, hash table) of IRC channel participants using the cl-irc library. :depends-on (:cl-irc :trivial-timeout)
(defun get-channel-users (nickname channel &key username password)
(let ((connection (irc:connect :nickname nickname
:username username
:password password)))
(unwind-protect
(with-timeout (60)
(irc:join connection channel)
(irc:add-hook connection 'irc:irc-rpl_endofnames-message
(lambda (msg)
(declare (ignore msg))
@joekarma
joekarma / gist:4022828
Created November 6, 2012 05:43
fbound symbols in package common-lisp. starting to tag destructive functions as :destructive.
List below was obtained with the following code:
(let (syms)
(do-symbols (sym :cl)
(when (fboundp sym)
(push sym syms)))
(format t "~{~(~a~)~%~}" (sort syms #'string<)))
I've added the :destructive keyword to lines where the function
is known to be destructive. I haven't gone over this entire list,
@joekarma
joekarma / gist:3991747
Created November 1, 2012 04:31
CL-IRC Test. Seems to be pinging out. :depends-on (:cl-irc)
;;; Trying to instrument handled events as well as unhandled events by
;;; monkey patching cl-irc:
(in-package :cl-irc)
(defmethod irc-message-event (connection (message irc-message))
(declare (ignore connection))
(if (apply-to-hooks message)
(client-log (connection message) message "HANDLED-EVENT:")
(client-log (connection message) message "UNHANDLED-EVENT:")))
(defun fold-left (op init seq)
(labels ((iter (result rest)
(if (null rest)
result
(iter (funcall op result (car rest)) (cdr rest)))))
(iter init seq)))
@joekarma
joekarma / gist:3966318
Created October 27, 2012 21:19
parenscript example
(ps:ps
(let ((hash (ps:create :foo "bar"
:baz "foo")))
(ps:@ hash :foo)))
;; =>
"(function () {
var hash = { 'foo' : 'bar', 'baz' : 'foo' };
return hash['foo'];
@joekarma
joekarma / gist:3965955
Created October 27, 2012 20:05
Common Lisp Website Using Only SEXP Syntaxes. Depends on '(:restas :cl-who :css-lite :parenscript)
(restas:define-module :hello-world-app
(:use :cl :cl-who))
(in-package :hello-world-app)
(restas:define-route index ("/")
(with-html-output-to-string (s nil :prologue t :indent t)
(:html
(:head
(:title "Hello World!")