This file contains 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 dzch/js-to-jsx-rename-file () | |
(interactive) | |
(let* | |
((path buffer-file-name) | |
(new-path (format "%sx" path))) | |
(rename-file path new-path) | |
(kill-buffer) | |
(find-file new-path))) |
This file contains 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 dzch/list-file-authors () | |
(interactive) | |
(let* ((path buffer-file-name) | |
(cmd "git log --pretty=format:%s %s | sort -r | uniq -c | sort -r") | |
(result (shell-command-to-string (format cmd "%ae" path)))) | |
(display-message-or-buffer result))) |
This file contains 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 duplicate-line () | |
(interactive) | |
(evil-yank-line (line-beginning-position)(line-end-position)) | |
(end-of-line) | |
(newline) | |
(evil-paste-before 1)) |
This file contains 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 git/commit-from-current-org-heading () | |
(interactive) | |
(setq commit-message (list/join (org-get-outline-path t) " - ")) | |
(shell-command (format "git commit -m %s" commit-messsage)) | |
(org-todo "DONE")) | |
(defun list/join (list delimiter) | |
(mapconcat 'identity list delimiter)) |
This file contains 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
(defconst dzch-fonts '("Fira Code" "Monaco")) | |
(defun font/change () | |
(interactive) | |
(setq next-active-font (ivy-completing-read "Choose font: " dzch-fonts)) | |
(setq doom-font (font-spec :family next-active-font :size 12)) | |
(doom/reload-font)) |
This file contains 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 gist/create-from-region (start end) | |
(interactive "r") | |
(setq contents (buffer-substring start end)) | |
(setq new-file-name | |
(read-string "Enter filename: ")) | |
(setq visibility (ivy-completing-read "Specify gist's visibility: " '("public" "secret"))) | |
(write-region start end new-file-name) | |
(shell-command (format "gh gist create %s --%s" new-file-name visibility)) | |
(delete-file new-file-name)) |
This file contains 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
(defn sock-merchant | |
[ar] | |
(->> | |
(frequencies ar) | |
(vals) | |
(map #(int (/ % 2))) | |
(reduce +))) |
This file contains 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 fish | |
function batch-ext-change | |
echo "Batch renaming files in the currect directory (recursively)" | |
read -l -P 'Old extension (without the "."): ' old_ext | |
read -l -P 'New extension (without the "."): ' new_ext | |
fd .$old_ext -X rename .$old_ext .$new_ext {} | |
end |
This file contains 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
(defn first-reccurring-character | |
([string-sequence] (first-reccurring-character string-sequence #{})) | |
([string-sequence lookup] | |
(let [current-character (first string-sequence)] | |
(if (contains? lookup current-character) | |
current-character | |
(recur (rest string-sequence) (conj lookup current-character)))))) |
NewerOlder