Skip to content

Instantly share code, notes, and snippets.

@nicferrier
nicferrier / bind-path.el
Last active December 14, 2015 17:59
map a url to variable names, suggested by #emacs jaimef. like what sinatra does
(defun elnode/bind-path (pattern httpcon)
(let* ((path (elnode-http-pathinfo httpcon))
(lst (split-string pattern "/" t))
(patlst
(let ((i 0))
(loop for part in lst
if (string-match-p "^:.*" part)
collect (cons i (intern (substring part 1)))
do (setq i (+ 1 i)))))
@henrik
henrik / hash_deep_diff.rb
Created July 14, 2009 08:38
Recursively diff two Ruby hashes.
# Recursively diff two hashes, showing only the differing values.
# By Henrik Nyh <http://henrik.nyh.se> 2009-07-14 under the MIT license.
#
# Example:
#
# a = {
# "same" => "same",
# "diff" => "a",
# "only a" => "a",
# "nest" => {