Skip to content

Instantly share code, notes, and snippets.

@gtod
gtod / pretty.lisp
Last active August 29, 2015 14:01
Pretty print cl-rethink query result
;;;; This is primarily to nicely format the query results from cl-rethinkdb
;;;; DON'T USE THE CODE BELOW. Instead do (after quickloading yason)
(defun pp-json (object &key (stream *terminal-io*) (indent 4))
"Pretty print JSON object to stream with specified indent"
(let ((s (yason:make-json-output-stream stream :indent indent)))
(yason:encode object s)))
----
@gtod
gtod / errors-test.lisp
Created April 8, 2014 23:50
Test wookie error handling explicitly
(defpackage :wookie-error-test
(:use :cl :cl-async-future :wookie :wookie-plugin-export :cl-who))
(in-package :wookie-error-test)
(defparameter *servers* '())
(load-plugins)
(defun app-error-handler (err socket)
;; grab our response object from the socket (keep in mind it may be null, so
;; check before using it)