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
| ;; github-friendly commit messages as per: | |
| ;; https://github.com/blog/926-shiny-new-commit-styles | |
| (add-hook 'magit-log-edit-mode-hook | |
| (lambda () | |
| ;; highlight too-long commit summary | |
| (set (make-local-variable 'whitespace-line-column) 50) | |
| (set (make-local-variable 'whitespace-style) '(face lines-tail)) | |
| (whitespace-mode 1) | |
| ;; autofill longer explanatory text | |
| (setq fill-column 72) |
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
| ;; pretty print a json region using python | |
| ;; | |
| ;; M-| python -m json.tool |
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
| (defadvice narrow-to-region (around clone-when-narrowing-already-visible-buffer activate) | |
| "Clone an indirect buffer when attempting to narrow the | |
| contents of buffer visible in more than one window." | |
| (save-excursion | |
| (when (> (length (get-buffer-window-list (current-buffer) nil nil)) 1) | |
| (let ((cloned-buffer (clone-indirect-buffer nil t) )) | |
| (switch-to-buffer cloned-buffer t))) | |
| ad-do-it)) |
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
| ;; Just an idea for Boscop. When (eq display-buffer-reuse-frames t) | |
| ;; display-buffer will raise the frame showing the compilation | |
| ;; buffer. This advice raises the original frame so focus is not in | |
| ;; the compilation buffer frame. | |
| (defadvice compile (around avoid-compile-switching-frames activate) | |
| (let ((cf (selected-frame))) | |
| ad-do-it | |
| (raise-frame cf))) |
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
| ;; Just an idea for Boscop. When (eq display-buffer-reuse-frames t) | |
| ;; display-buffer will raise the frame showing the compilation | |
| ;; buffer. This advice raises the original frame so focus is not in | |
| ;; the compilation buffer frame. | |
| (defadvice compile (around avoid-compile-switching-frames activate) | |
| (let ((cf (selected-frame))) | |
| ad-do-it | |
| (raise-frame cf))) |
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
| -- make all unbound vars of the form rNN resolve to level.rings[NN] | |
| mt={} | |
| mt.__index=function (t, k) | |
| local r, rindex = string.find(k, "r%d", 0) | |
| rindex = rindex and tonumber(string.sub(k, rindex)) | |
| if rindex then | |
| return level.rings[rindex] | |
| else | |
| return nil |
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
| sudo port clean --all installed | |
| sudo port -f uninstall inactive |
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
| ;; load objc-mode for objective-C header files | |
| (add-to-list 'magic-mode-alist | |
| '((lambda () | |
| (and (string= (file-name-extension buffer-file-name) "h") | |
| (re-search-forward "@\\<interface\\>" magic-mode-regexp-match-limit t))) | |
| . objc-mode)) | |
| ;;set .m <-> .h correspondence for ff-find-other-file | |
| (add-hook 'objc-mode-hook | |
| (lambda () |
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
| (c-add-style "bsd-jimmy" | |
| '("bsd" (c-basic-offset . 4))) | |
| (add-to-list 'c-default-style '(c++-mode . "bsd-jimmy")) |
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
| printf("%x xor %x = %x \n", a, b, a ^ b); | |
| printf("%x xor %x = %x \n", a, res, a ^ res); | |
| printf("%d - %d = %d (overflow: %d)\n", a, b, res, overflow); | |
| printf("%x - %x = %x (overflow: %x)\n", a, b, res, overflow); |