This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(helm :sources (helm-build-sync-source "Buffers" | |
:candidates (lambda () (helm-buffer-list)) | |
:filtered-candidate-transformer | |
'(helm-skip-boring-buffers | |
helm-buffers-sort-transformer) | |
:volatile t) | |
:buffer "*helm my buffers*") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun incf-at-point () | |
"Increment number at point by 1." | |
(interactive) | |
(let ((number (number-at-point)) | |
bounds beg end) | |
(if number | |
(progn | |
(setq bounds (bounds-of-thing-at-point 'sexp)) | |
(setq beg (car bounds) | |
end (cdr bounds)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(let* ((ev (read-event "Select a window with mouse: " nil)) | |
(pos (when (consp ev) (nth 1 ev))) | |
(wind (when pos (posn-window pos)))) | |
(message-box "%s - %s" (current-buffer) ev)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(let ((a 1) (b 2)) | |
(setq a (prog1 b (setq b a))) | |
(list a b)) | |
;; => (2 1) | |
(let ((con '(1 . 2))) | |
(setcar con (prog1 (cdr con) | |
(setcdr con (car con)))) | |
con) | |
;; => (2 . 1) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(setq helm-echo-input-in-header-line t) | |
;; Hide minibuffer when the above option is on. | |
(add-hook 'helm-minibuffer-set-up-hook | |
#'helm-hide-minibuffer-maybe) | |
;; Don't use helm's own displaying mode line function | |
(fset 'helm-display-mode-line #'ignore) | |
(add-hook 'helm-after-initialize-hook | |
(defun hide-mode-line-in-helm-buffer () |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Put it in your .zshrc or .bashrc | |
function ef { sed -n 's/^ *"\(.*\)"/\1/p' ~/.emacs.d/recentf | pick | xargs $EDITOR } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun show-major-mode-name-action (candidate) | |
(with-current-buffer candidate | |
(unless (eq major-mode 'messages-buffer-mode) | |
(message "The major-mode name of buffer at the cursor is %S" | |
major-mode)))) | |
(helm :sources (helm-build-sync-source "buffers" | |
:candidates '("*scratch*" "*Messages*") | |
:action #'show-major-mode-name-action)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env tclsh | |
# hello-tcl.tcl | |
# Make some variables for testing | |
set name "Chunyang Xu" | |
set age 22 | |
set mail [format "%s@%s" chunyang macports.org] | |
set blog http://xuchunyang.me |