Skip to content

Instantly share code, notes, and snippets.

@mixio
mixio / Text Substitutions.plist
Created January 18, 2022 22:22
Countries Text Substitutions.plist
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<array>
<dict><key>shortcut</key><string>AD</string><key>phrase</key><string>Andorra</string></dict>
<dict><key>shortcut</key><string>AE</string><key>phrase</key><string>United Arab Emirates</string></dict>
<dict><key>shortcut</key><string>AF</string><key>phrase</key><string>Afghanistan</string></dict>
<dict><key>shortcut</key><string>AG</string><key>phrase</key><string>Antigua and Barbuda</string></dict>
@mixio
mixio / select_contents_of_nth_tag.scpt
Last active March 15, 2022 09:11
BBEdit script to select inner contents of Nth tag of front document
(*
FILENAME:
select_contents_of_nth_tag.scpt
README:
This script:
• asks for a "tag#index" pair separated by a '#' hash mark:
- "tag" is the name of the seeked tag,
- "index" is the number of the seeked tag;
@mixio
mixio / find_longest_repeated_substring.go
Created April 30, 2022 18:28
A BBEdit Text Filter that will help find a document's longest repetition
#!/usr/bin/env gorun
// Original code: https://rosettacode.org/wiki/Ukkonen’s_suffix_tree_construction
/*
Here is a BBEdit Text Filter that will scan the frontmost document's selected text (or the whole document in no selection) for the longest repeated substring and log a regular expression in the 'Unix Script Output.log' that allows you to find the repetition.
It works by replacing all non alphanumeric or underscore characters with a regular expression, thus comparing only the 'text' and ignoring anything else: whitespace, punctuation, math operators, etc.
As a consequence, it's more useful on textual content than on code.
@mixio
mixio / sort_and_merge_indented_list.applescript
Last active October 16, 2022 18:30
BBEdit script to sort indented hierarchical lists
(*
README
Considering that list indentation is a form of compression, this BBEdit script
decompresses the list, sorts it with the shell `sort` command, and compresses it back again.
In doing so, the indented list will be sorted, sub lists will be merged and
duplicates will be eliminated.
For sorting options (case insensitive, etc.) see the `sort` man page in terminal and
@mixio
mixio / copy_markdown_as_html.applescript
Last active November 8, 2022 16:58
This BBEdit script copies a markdown document's selection as HTML to the pasteboard.
(*
README
This BBEdit script copies a markdown document's selection as HTML to the pasteboard.
In case nothing is selected it copies the whole contents of the document.
DOCUMENTATION
https://pandoc.org