Skip to content

Instantly share code, notes, and snippets.

View sourcekit-lsp.txt
lsp--stdio-wait: Content-Length: 1534
"jsonrpc": "2.0",
"method": "initialize",
"params": {
"processId": 512,
"rootPath": "/Users/dmartin/Downloads/CryptoSwift-master/Sources/CryptoSwift/",
"rootUri": "file:///Users/dmartin/Downloads/CryptoSwift-master/Sources/CryptoSwift/",
"capabilities": {
danielmartin / copy-as-rtf.el
Created Jul 6, 2019
Export an Org region to RTF and copy it to the clipboard. Ideal for copying source code blocks to Google Docs and preserve syntax highlighting and indentation.
View copy-as-rtf.el
(defun dm/copy-as-rtf ()
"Export region to RTF and copy it to the clipboard."
(let* ((buf (org-export-to-buffer 'html "*Formatted Copy*" nil nil t t))
(html (with-current-buffer buf (buffer-string))))
(with-current-buffer buf
View ReflectSuperclasses.swift
import Foundation
import UIKit
/// Some helpers for having nice test assertions.
public func expectationFailure(
_ reason: String,
trace message: String) {
print(reason, terminator: reason == "" ? "" : "\n")
print(message, terminator: message == "" ? "" : "\n")
danielmartin /
Created Oct 19, 2019
This gist describes how to switch Xcode schemes and run destinations using keybindings and Xcode behaviors.

How to Switch Xcode Schemes Quickly Using Keybindings

If you have a lot of schemes in your Xcode project, searching for the one you want to run may be slow, even if you use the “search as you type” feature. Because of this, you may choose to hide or not generate schemes that you don’t regularly use. Here’s an example of an Xcode project with a lot of schemes:

danielmartin / XcodeNewBuildSystemSettings.json
Created Feb 23, 2020
Complete list of Xcode new build system settings and their documentation in JSON format.
View XcodeNewBuildSystemSettings.json
This file has been truncated, but you can view the full file.
"spec": "",
"path": "/Applications/ Compiler.xcspec",
"options": [
danielmartin / Magit-change-commit-author.el
Last active Sep 21, 2020
Press "h" in a Magit interactive rebase to change the commit author of some commits. Username completion is provided by the git shortlog.
View Magit-change-commit-author.el
(defun dm/change-commit-author (arg)
"Change the commit author during an interactive rebase in Magit.
With a prefix argument, insert a new change commit author command
even when there is already another rebase command on the current
line. With empty input, remove the change commit author action
on the current line, if any."
(interactive "P")
(let ((author
(magit-transient-read-person "Select a new author for this commit"
danielmartin / kill-diff.el
Last active Mar 10, 2021
Emacs function to kill added/removed lines of diff output, removing the diff markers
View kill-diff.el
(defun dm/kill-diff (arg)
"Kill added/removed lines of diff output, removing the diff markers.
Without a prefix argument or a positive argument, kill the added
lines. With a negative argument, kill the removed lines."
(interactive "P")
(thread-last (buffer-substring-no-properties
danielmartin /
Last active May 10, 2021
Add support for a better Xcode's Jump to Next Counterpart in Swift

If you work on a Swift project that follows the Model-View-ViewModel (MVVM) architecture or similar, you may want to jump to counterpart in Xcode from your view to your model, and then to your view model. (ie. by using Ctrl+Cmd+Up and Ctrl+Cmd+Down).

You can do this in recent versions of Xcode by setting a configuration default.

From a terminal, just type this command and press Enter:

defaults write IDEAdditionalCounterpartSuffixes -array-add "ViewModel" "View"