Awesome PHP has been relocated permanently to its own Github repository. No further updates will made to this gist.
Please open an issue for any new suggestions.
| (defun shell-command-on-region-to-string (start end command) | |
| (with-output-to-string | |
| (shell-command-on-region start end command standard-output))) |
| (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) |
| (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)) |
| (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)) |
Awesome PHP has been relocated permanently to its own Github repository. No further updates will made to this gist.
Please open an issue for any new suggestions.
| (setq url-http-attempt-keepalives nil) |
| (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)) |
| (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) |
Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)That's it!
| (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)) |