Skip to content

Instantly share code, notes, and snippets.

View matthewspear's full-sized avatar
🔨
Always Be Learning

Matt Spear matthewspear

🔨
Always Be Learning
View GitHub Profile
@matthewspear
matthewspear / Contents.swift
Created June 5, 2019 16:36
A TableView-Style List in SwiftUI
import SwiftUI
import PlaygroundSupport
struct Contact: Identifiable {
// important for each to be unique
var id = UUID()
var name: String
}
@matthewspear
matthewspear / ToggleGreyscale.scpt
Created April 27, 2020 13:32
Slightly hacky script to toggle macOS greyscale mode on / off.
tell application "System Preferences"
set current pane to pane id "com.apple.preference.universalaccess"
delay 1
tell application "System Events" to tell process "System Preferences" to tell window "Accessibility"
select row 5 of table 1 of scroll area 1
tell tab group 1 of group 1
click radio button "Colour Filters"
click pop up button 1
click menu item "Greyscale" of menu 1 of pop up button 1
click checkbox "Enable Colour Filters"
@matthewspear
matthewspear / common_commands.sh
Last active May 26, 2020 01:41
Find out which commands you use most on the command-line
history > history.txt
awk '{print $1}' ../history.txt > commands.txt
cat commands.txt | sort | uniq -c | sort -r > sorted_commands.txt