Skip to content

Instantly share code, notes, and snippets.

View jaeschliman's full-sized avatar

Jason Aeschliman jaeschliman

View GitHub Profile
@jaeschliman
jaeschliman / struct-equal.lisp
Last active August 29, 2015 14:03
struct-equal for ccl and sbcl
(defpackage :struct-equal (:use :cl) (:export :struct-equal))
(in-package :struct-equal)
#+sbcl
(in-package :sb-impl)
#+sbcl
(defun struct-equal:struct-equal (x y &optional (subtest #'equalp))
(flet ((raw-instance-slots-equal (layout x y)
(loop with i = -1
@jaeschliman
jaeschliman / emacs-set-app-icon.m
Created January 24, 2014 03:18
change the Emacs.app application icon while it's running
/*
I typically run several emacs instances at once,
One handling IM and my timecard etc,
and one for each project I'm currently working on.
This way I can tailor a given instance of emacs to a given project
as much as I want without interfering with the others,
it simplifies buffer-switching and desktop saving etc.
But it gets to be a PITA command-tabbing between them as they all have the same icon.
This fixes that.
@jaeschliman
jaeschliman / gist:7936195
Last active December 31, 2015 04:48
POC Objective C style KVO in common lisp.
(ql:quickload '(:closer-mop :alexandria))
;;; see end of file for an example usage
(defpackage :kvo (:use :closer-common-lisp :closer-mop :alexandria))
(in-package :kvo)
(defclass %o ()
((observers :accessor observers :initform (make-hash-table :test 'eq))))
;; your original change_fun
(defun change_fun (fun x)
(cond ((eq fun 'sin) (list 'cos x))
((eq fun 'cos) (list '- 0 (list 'sin x)))
((eq fun 'tan) (list '+ 1 (list '* (list 'tan x) (list 'tan x))))
((eq fun 'log) (list '/ 1 x))
(T
(error "Not a function! ~S " fun)))
)
@jaeschliman
jaeschliman / codechars.txt
Created October 10, 2012 14:23
common lisp character literals below (code-char 32)
;;;; ECL,CCL,SBCL,ACL
;; ECL | x86_64 | 12.7.1
0 #\Nul
1 #\Soh
2 #\Stx
3 #\Etx
4 #\Eot
@jaeschliman
jaeschliman / include.lisp
Created October 4, 2012 15:34
include an external file in a binary for later use, with shell transcript
;;
;; in the directory /tmp/include-binary/
;; containing a file foo.jpg, this file, and product.lisp
;;
;;
;; $ ls -la
;; total 768
;; drwxr-xr-x 5 user wheel 170 Oct 4 08:28 .
;; drwxrwxrwt 19 root wheel 646 Oct 4 08:25 ..
@jaeschliman
jaeschliman / overview.lisp
Created September 7, 2012 17:59
overview of the protocol, sequence, iterator, and iterate+ packages.
#|
UPDATE: this file no longer works with the changes
pushed to github today (2012-09-17) will fix it
soon.
A working overview of the protocol, sequence,
iterator, and iterate+ packages.
These packages are each quite small and are