Skip to content

Instantly share code, notes, and snippets.

;;; Author: Scott Jaderholm
;;; Created: 2009-12-18
;;;
;;; Short Description: Automates the creation of unit conversion
;;; functions and includes several common ones.
;;;
;;; Detailed Description: So for inches, feet, and meters, if you
;;; provide equations for inches-to-feet and feet-to-meters, then this
;;; package will automatically create feet-to-inches, meters-to-feet,
;;; inches-to-meters, meters-to-inches, and all the corresponding
;;; Example of slices
(slice site-settings [bgcolor] ; slices can take arguments
:var {default-background-color bgcolor}) ; variable for anyone that uses this slice
(slice site-settings-public ; slices don't need an arg list if they don't take args
:use (site-settings "blue")) ; what other slices this slice uses
(slice site-settings-app
:use (site-settings "red"))
;;; tried this
(when-let [con (resolve 'swank.core.connection/*current-connection*)]
(do (def swank-connection con)
(defmacro break []
`(binding [swank.core.connection/*current-connection* swank-connection]
(swank.core/break)))))
;;; compiled but when running
(break)
;; get stack overflow on invoke var
@scottjad
scottjad / josephus.clj
Created August 23, 2011 05:06
stupid benchmark
;; (set! *warn-on-reflection* true)
(set! *unchecked-math* true)
(import 'java.util.ArrayList)
(defn shout [^long counter ^long nth [^long cnt ^ArrayList coll]]
(loop [counter counter
[count soldiers] [cnt coll]]
(if (= 1 count)
(.get ^ArrayList soldiers 0)
@scottjad
scottjad / Rakefile.diff
Created September 27, 2011 06:59
Octopress Rakefile changes to support org-mode
@@ -20,9 +20,10 @@ blog_index_dir = 'source' # directory for your blog's index pa
deploy_dir = "_deploy" # deploy directory (for Github pages deployment)
stash_dir = "_stash" # directory to stash posts for speedy generation
posts_dir = "_posts" # directory for blog files
+org_posts_dir = "org_posts"
themes_dir = ".themes" # directory for blog files
-new_post_ext = "markdown" # default new post file extension when using the new_p
-new_page_ext = "markdown" # default new page file extension when using the new_p
+new_post_ext = "org" # default new post file extension when using the new_post t
+new_page_ext = "org" # default new page file extension when using the new_page t
(defface diff-refine-change-add
'((t :background "#aaffaa" :foreground "black"))
"Face used for char-based changes shown by `diff-refine-hunk'."
:group 'diff-mode)
(defface diff-refine-change-del
'((t :background "#ffaaaa" :foreground "black"))
"Face used for char-based changes shown by `diff-refine-hunk'."
:group 'diff-mode)
(in-package :stumpwm)
(defun select-from-dmenu (screen table &optional prompt
(initial-selection 0))
"Prompt the user to select from a menu using dmenu on SCREEN. TABLE can be
a list of values or an alist. If it's an alist, the CAR of each
element is displayed in the menu. What is displayed as menu items
must be strings. Returns the selected element in TABLE or nil if aborted."
(let* ((menu-options (mapcar #'menu-element-name table))