Skip to content

Instantly share code, notes, and snippets.

(define-skeleton html-tag
"autogen html tags"
"Enter tag:"
"<"str">" _ "")
(define-key (current-local-map) (kbd "C-c h") 'html-tag)
;; skeletons defined by me
(defun my-erb-mode-hook()
(define-skeleton rails-erb-eval
"<% %>"
nil
"<% " _ " %>")
(define-key (current-local-map) (kbd "C-c i") 'rails-erb-eval)
(define-skeleton rails-erb-block-end
"<% end %>"
(define-key (current-global-map) (kbd "C-c p") 'rails-erb-print)
(define-skeleton
rails-erb-print ;命令名称
"auto type <%= %>" ;说明
nil
"<%= " _ " %>") ;模版
(defmacro define-skeleton (command documentation &rest skeleton)
"Define a user-configurable COMMAND that enters a statement skeleton.
DOCUMENTATION is that of the command.
SKELETON is as defined under `skeleton-insert'."
...)
@imonyse
imonyse / lambda.el
Created April 21, 2011 05:27
lisp lambda
(lambda () "DOCSTRING" (interactive) BODY)
# Video: http://rubyhoedown2008.confreaks.com/08-chris-wanstrath-keynote.html
Hi everyone, I'm Chris Wanstrath.
When Jeremy asked me to come talk, I said yes. Hell yes. Immediately. But
then I took a few moments and thought, Wait, why? Why me? What am I supposed
to say that's interesting? Something about Ruby, perhaps. Maybe the
future of it. The future of something, at least. That sounds
keynote-y.
@imonyse
imonyse / board.js
Created April 8, 2011 14:41
A Go Board, not completed yet
var boardSize = 19;
var pieceSize = 25;
var pixelFix = 12.5;
var starRadius = 3;
var stoneRadius = 12;
var turn = 0; // 0 => black, 1 => white
var pixelSize = pixelFix*2 + ((boardSize - 1) * pieceSize);
@imonyse
imonyse / .emacs
Created April 3, 2011 16:31
My Emacs Init File
(transient-mark-mode t)
(setq-default make-backup-files nil)
(setq inhibit-startup-message t)
(global-font-lock-mode t)
(setq x-select-enable-clipboard t)
(server-start)
(put 'set-goal-column 'disabled nil)
(setq truncate-partial-width-windows nil)
(add-hook 'c-mode-common-hook