Skip to content

Instantly share code, notes, and snippets.

@milkypostman
milkypostman / shell-command-region-to-string.el
Created October 13, 2011 03:51
Shell Command Function in Elisp
(defun shell-command-on-region-to-string (start end command)
(with-output-to-string
(shell-command-on-region start end command standard-output)))
@fukamachi
fukamachi / test-utils.lisp
Created October 27, 2011 11:56
Useful utilities for CL testing.
(in-package :cl-user)
(ql:quickload :cl-test-more)
(defun asdf-component-files (comp)
(etypecase comp
(asdf::cl-source-file
(list (asdf:component-pathname comp)))
(asdf::static-file nil)
(asdf::component
(loop for c in (asdf:module-components comp)
@diasjorge
diasjorge / init_packages.el
Created October 31, 2011 09:54
Bootstrapping el-get + packages
(setq el-get-sources
'((:name package-name)))
(defun sync-packages ()
"Synchronize packages"
(interactive)
(el-get 'sync '(el-get package))
(add-to-list 'package-archives '("tromey" . "http://tromey.com/elpa/"))
(add-to-list 'package-archives '("marmalade" . "http://marmalade-repo.org/packages/"))
(setq my-packages (mapcar 'el-get-source-name el-get-sources))
@itoshkov
itoshkov / toggle-earmuffs.el
Created November 22, 2011 09:20
Emacs lisp toggle-earmuffs
(defun toggle-earmuffs ()
"Add or remove earmuffs (asterisks at front and end) of
variables."
(interactive)
(let* ((saved-point (point))
(variable (thing-at-point 'symbol))
(bounds (bounds-of-thing-at-point 'symbol))
(len (- (cdr bounds) (car bounds)))
(start-char (elt variable 0))
@ziadoz
ziadoz / awesome-php.md
Last active February 3, 2025 20:55
Awesome PHP — A curated list of amazingly awesome PHP libraries, resources and shiny things.
@milkypostman
milkypostman / gist:1679208
Created January 25, 2012 22:17
Fix for HTTP Keep-Alive in Emacs
(setq url-http-attempt-keepalives nil)
@kristianhellquist
kristianhellquist / gist:1772649
Created February 8, 2012 19:28
Easier typing in Aquamacs for a swedish keybord
(defun mac-osx-editing-insert-at ()
"Insert @ at point"
(interactive)
(insert-char ?@ 1))
(defun mac-osx-editing-insert-curly-left ()
"Insert { at point"
(interactive)
(insert-char ?{ 1))
@fukamachi
fukamachi / gist:1922987
Created February 27, 2012 10:22
Emacs settings for Clack developers
(defun clack-slime-search-buffer-package ()
(let ((case-fold-search t)
(regexp (concat "^(\\(clack.util:\\)?namespace\\>[ \t']*"
"\\([^\n)]+\\)")))
(save-excursion
(if (or (re-search-backward regexp nil t)
(re-search-forward regexp nil t))
(match-string-no-properties 2)
(slime-search-buffer-package)))))
(setq slime-find-buffer-package-function 'clack-slime-search-buffer-package)
@hrldcpr
hrldcpr / tree.md
Last active January 6, 2025 22:43
one-line tree in python

One-line Tree in Python

Using Python's built-in defaultdict we can easily define a tree data structure:

def tree(): return defaultdict(tree)

That's it!

@kriyative
kriyative / clj-thrush.lisp
Created March 13, 2012 18:40
Clojure `thrush` operator macro in Common Lisp
(defmacro -> (x &rest args)
"A Common-Lisp implementation of the Clojure `thrush` operator."
(destructuring-bind (form &rest more)
args
(cond
(more `(-> (-> ,x ,form) ,@more))
((and (consp form)
(or (eq (car form) 'lambda)
(eq (car form) 'function)))
`(funcall ,form ,x))