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
(cl-defun wh/foo (arg1 arg2 &key (kwarg1 t)) | |
(list arg1 arg2 kwarg1)) | |
;; We've forgotten arg2, but we get the error: | |
;; (error "Keyword argument 2 not one of (:kwarg1)") | |
(wh/foo 1 :kwarg1 2) | |
;; Instead, it would be clearer to say | |
;; "Expected a keyword argument (one of (:kwargs1)) but got 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
;; Loosely based on `erc-remove-text-properties-region'. | |
(defun wh/remove-text-properties-region () | |
"Remove all text properties from the current buffer." | |
(interactive) | |
(let ((inhibit-read-only t)) | |
(set-text-properties (point-min) (point-max) 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
;;; dashtest.el --- benchmarking dash -*- lexical-binding: t -*- | |
(defmacro --map-mapcar (form list) | |
(declare (debug (form form))) | |
`(mapcar (lambda (it) ,form) ,list)) | |
(defmacro --map-loop (form list) | |
(declare (debug (form form))) | |
(let ((result-sym (make-symbol "result"))) | |
`(let (,result-sym) |
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
void print_elements(int* arr, int arr_length) { | |
for (int i = 0; i < arr_length; i++) { | |
printf("arr[i] = %d\n", arr[i]); | |
} | |
} |
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
[package] | |
name = "remacs" | |
version = "0.1.0" | |
authors = ["Wilfred Hughes <[email protected]>"] | |
[lib] | |
crate-type = ["staticlib"] |
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 racer--slurp (path) | |
"Return the contents of file PATH as a string." | |
(with-temp-buffer | |
(insert-file-contents-literally path) | |
(buffer-string))) |
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
function foo() { | |
try { | |
throw new Error(); | |
} finally { | |
return 42; | |
} | |
} | |
// Logs 42 | |
console.log(foo()); |
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
@namespace url(http://www.w3.org/1999/xhtml); | |
@-moz-document domain("stackoverflow.com") { | |
#hot-network-questions { | |
display: none; | |
} | |
.community-bulletin { | |
display: none; | |
} |
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
(require 'dash) | |
(defun wh/ido-switch-buffer-with-filename () | |
"Switch to a buffer with ido, including the filename in the prompt." | |
(interactive) | |
(let* ((bufs (buffer-list)) | |
(bufs-with-paths | |
(--map (with-current-buffer it | |
(if (buffer-file-name) | |
(format "%s <%s>" (buffer-name) (buffer-file-name)) |
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
class Parent(object): | |
def __init__(self): | |
# I inherit from object, so I don't need to call: | |
# super().__init__() | |
# right? If Python only had single inheritance, that would be | |
# true. I could see, statically, what method is next in the | |
# lookup path. | |
pass | |