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
// Run any SwiftUI view as a Mac app. | |
// Based on https://gist.github.com/chriseidhof/26768f0b63fa3cdf8b46821e099df5ff | |
import Cocoa | |
import SwiftUI | |
NSApplication.shared.run { | |
VStack(spacing: 0) { | |
Rectangle().fill(Color.green) | |
Rectangle().fill(Color.yellow) |
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
(use-package org | |
:hook ((org-mode . org-display-inline-images)) | |
:config | |
(use-package ob | |
:bind (:map org-mode-map | |
("C-c C-c" . org-ctrl-c-ctrl-c)) | |
:config | |
(use-package ob-swift |
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
struct ContentView: View { | |
var body: some View { | |
ZStack(alignment: .bottom) { | |
// ... | |
VisualEffectView(effect: UIBlurEffect(style: .systemUltraThinMaterial)) | |
.animation(.easeInOut) | |
.edgesIgnoringSafeArea(.all) | |
.onTapGesture { | |
UIApplication.shared.sendAction( | |
#selector(UIResponder.resignFirstResponder), |
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
import SwiftUI | |
private let linkDetector = try! NSDataDetector(types: NSTextCheckingResult.CheckingType.link.rawValue) | |
struct LinkColoredText: View { | |
enum Component { | |
case text(String) | |
case link(String, URL) | |
} |
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 dwim-shell-commands-video-to-hevc-mkv () | |
"Convert all marked videos to hevc mkv." | |
(interactive) | |
(dwim-shell-command-on-marked-files | |
"Convert video to h265 " | |
"REPO_DIR=/tmp/other_video_transcoding | |
if ! [ -d \"$REPO_DIR\" ] | |
then | |
git clone https://github.com/donmelton/other_video_transcoding.git $REPO_DIR | |
fi |
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 ar/chatgpt-decline-offer-from-sender () | |
(interactive) | |
(unless (eq major-mode 'mu4e-compose-mode) | |
(user-error "Not in mu4e:compose mode")) | |
(let ((chatgpt-shell-prompt-query-response-style 'inline)) | |
(chatgpt-shell-send-to-buffer | |
(concat "write a succinct email reply body and kindly decline explictly to the following email as I am not interested: \n\n" | |
(buffer-substring-no-properties (point-min) (point-max)))))) |
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
;; Needs make-mu4e-context :vars mu4e-spam-folder set. | |
;; Generates `mu4e-headers-mark-for-spam'. | |
(mu4e~headers-defun-mark-for spam) | |
(defun ar/mu4e-mark-junk-candidates-using-chatgpt () | |
"Mark potential messages as junk by asking ChatGPT." | |
(interactive) | |
(save-restriction | |
(narrow-to-region (window-start) |
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
(use-package dwim-shell-command | |
:ensure t | |
:bind (:map dired-mode-map | |
("C-c d" . dwim-shell-commands-duplicate)) | |
:config | |
;; Loads all my own dwim shell commands. | |
(require 'dwim-shell-commands)) |
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 dwim-shell-commands-duplicate () | |
(interactive) | |
(dwim-shell-command-on-marked-files | |
"Duplicate file(s)." | |
"cp '<<f>>' '<<f(u)>>'" | |
:utils '("cp" "scp") | |
:post-process-template | |
(lambda (script file) | |
(if (tramp-tramp-file-p file) | |
;; Tramp file path start with "/ssh:". Drop it. |
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 ar/eval-uncommented-region (start end) | |
(interactive "r") | |
(let ((text (buffer-substring-no-properties start end))) | |
(with-temp-buffer | |
(insert text) | |
(emacs-lisp-mode) | |
(uncomment-region (point-min) (point-max)) | |
(eval-buffer) | |
(message "Evaluated")))) |
OlderNewer