Skip to content

Instantly share code, notes, and snippets.

View making's full-sized avatar

Toshiaki Maki making

View GitHub Profile
(defmethod diagonal ((box <body>))
(let ((vertices (vertices-of box))
(max-point (make-float-vector 3))
(min-point (make-float-vector 3))
)
(copy-vector (car vertices) max-point)
(copy-vector (car vertices) min-point)
(dolist (v (cdr vertices))
(dotimes (i 3)
(when (> (aref v i) (aref max-point i))
(require :komainu)
(use-package :nurarihyon)
(use-package :nurikabe)
(use-package :chimi)
(use-package :komainu)
(defclass* <pgrl>
()
((environment nil)
(n 0)
NameVirtualHost *:80
<VirtualHost *:80>
ServerName example.xom
DocumentRoot /var/www/html
</VirtualHost>
<VirtualHost *:80>
ServerName hunchentoot.example.com
ProxyPass / http://127.0.0.1:4242/
(defmacro with-layout ((&key (header *header-html*)
(side *side-html*)
(footer *footer-html*)
(title "title here")
(css "/css/main.css")
)
&body body)
`(cl-who:with-html-output-to-string (*standard-output* nil :prologue nil :indent t)
(:html
(:head (:title ,title)
(defmacro sexp-file->html (fname)
(let ((sexp (with-open-file (f fname) (read f))))
`(cl-who:with-html-output-to-string (*standard-output*) ,sexp)
)
)
;; -- foo.sexp --
;; (:p
;; (:ul
;; (:li "foo")
(defmacro try-catch ((&body try) &rest errors)
`(handler-case () (progn ,@try) ,@errors))
;; (try-catch (
;; (foo)
;; (bar)
;; )
;; (simple-error (c) (warn "simple-error! ~a" c))
;; (error (c) (warn "error! ~a" c))
;; )
(defmacro config-value-bind ((fname &rest symbols) &body body)
(let ((s (gensym "s"))
(f (gensym "f"))
)
`(with-open-file (,f ,fname)
(let* ((,s (read ,f))
,@(mapcar #'(lambda (x) `(,x (cdr (assoc ',x ,s)))) symbols)
)
,@body
)
++++++++[>+++++++++<-]>.<+++++[>++++++<-]>-.<++[>+++<-]>+..+++.<++++++[>----<-]>.<++++++[>++++<-]>.+++.------.--------.
\newcommand{\subsubsubsection}{\@startsection{paragraph}{4}{\z@}%
{1.5\Cvs \@plus.5\Cdp \@minus.2\Cdp}%
{.5\Cvs \@plus.3\Cdp}%
{\reset@font\normalsize\sffamily}
}
(defn add-classpath-dir
[dir]
(let [files (.listFiles (java.io.File. dir))]
(doseq [f (filter (fn [f] (and (.isFile f)
(.endsWith (.getName f) ".jar"))) files)]
(add-classpath (.toURL (.toURI f)))
)
)
)