Skip to content

Instantly share code, notes, and snippets.

@bhyde
bhyde / graph-quicklisp-system
Last active December 21, 2015 11:29
Generate a graphviz of the systems required by a the given system, let dot render that, then have emacs display it. Calls back to emacs via swank::eval-in-emacs.
(in-package #:cl-user)
;; Must do ...
;; (setf slime-enable-evaluate-in-emacs t)
;; ... in emacs first. And, dot must be installed.
(defun graph-quicklisp-system (ql-system-designation)
"Display graph of system requirements."
(let ((dot-file "/tmp/ql-system.dot")
(png-file "/tmp/ql-system.png"))
@bhyde
bhyde / ql-tools.lisp
Last active April 26, 2016 15:08
A few things for playing with quicklisp metadata. Note that this reveals assorted things that make life interesting; so use 'em in a clean discardable session. Probably ccl only.
(in-package #:cl-user)
(eval-when (:compile-toplevel :load-toplevel :execute)
(ql:quickload "cl-ppcre")
(ql:quickload "optima")
(ql:quickload "optima.ppcre")
(use-package '#:optima)
(use-package '#:optima.ppcre))
(defun ensure-all-system-are-downloaded ()
@bhyde
bhyde / index.html
Last active December 18, 2015 23:19
D3, a slightly sorted
<head>
<style>
.node {
stroke: #fff;
stroke-width: 1.5px;
}
.link {
fill: none;
stroke: #666;
stroke-width: 1.5px;
@bhyde
bhyde / example-named-readtable.lisp
Last active December 26, 2016 23:03
Named-Readtables, and example.
;;;; Load some utilities
;;; ... typically this would go in our ASDF system file.
;;; in which case you wouldn't need the eval when
(eval-when (:compile-toplevel :load-toplevel :execute)
(ql:quickload "cl-interpol")
(ql:quickload "named-readtables"))
;;;; Define a package and a read table.
@bhyde
bhyde / slime-plz-use-asdf-cache.el
Created June 17, 2013 19:46
A few lines of elisp to instruct slime to ask swank to use the asdf fasl cache directories when it compiles things. For example using C-c C-k.
;;; elisp that instructs slime/swank to use the ASDF cache for fasl files.
;;; add this to your emacs init file; and the magic happens.
(defun setup-to-save-swank-fasls-in-asdf-cache ()
;; based on http://article.gmane.org/gmane.lisp.slime.devel/11080
(slime-eval-print "
(flet ((find-fasl (path options)
(declare (ignore options))
(let ((fasl-path
(asdf:apply-output-translations
(compile-file-pathname path))))
@bhyde
bhyde / dump-doc.lisp
Last active December 18, 2015 08:29
(in-package #:cl-user)
(defun display-doc-of-package-exports (package)
"Simple code to display the documenation for a package's exports."
(flet ((arglist (sym)
#+ccl (ccl:arglist sym)
#-ccl ()))
(let ((*package* (find-package package)))
(do-external-symbols (s *package*)
(loop
@bhyde
bhyde / slime-documentation-search.el
Last active December 18, 2015 05:48
Hand off slime doc search to a website, bound to C-c C-d C-s, defaults to quickdocs.org.
;;; -*- lexical-binding: t -*-
(define-slime-contrib slime-documentation-search
"Hand off a documenation search to a web site."
(:authors "Ben Hyde <[email protected]>")
(:license "GPL")
(:on-load
(define-key slime-doc-map "\C-s" 'slime-documention-search)
(define-key slime-doc-map "s" 'slime-documention-search)))
@bhyde
bhyde / redirect.md
Last active December 18, 2015 03:59
Code to scrap cl-ppcre's doc page and build the redirect table as used by l1sp.org.
@bhyde
bhyde / gist:5722301
Created June 6, 2013 15:15
An alternate binding for slime's slime-documentation-lookup-function. Uses l1sp.org if invoked with a prefix arg.
(defun slime-hyperspec-plus-l1sp-lookup (symbol-name)
"The usual hyperspec lookup, but with a prefix arg uses l1sp.org instead"
(interactive (list (let* ((symbol-at-point (slime-symbol-at-point))
(stripped-symbol
(and symbol-at-point
(downcase
(common-lisp-hyperspec-strip-cl-package
symbol-at-point)))))
(if (and stripped-symbol
(or current-prefix-arg
@bhyde
bhyde / gist:5673492
Created May 29, 2013 20:18
Snarf historical prices from ebay... via common lisp
(in-package "CL-USER")
(let ((*print-case* :upcase))
(ql:quickload '(#:fare-memoization #:parse-number
#:optima #:optima.ppcre #:fare-quasiquote-optima
#:drakma #:closure-html)))
(defpackage #:eb
(:use #:common-lisp #:fare-memoization #:parse-number
#:optima #:optima.ppcre