Bash expects just a few files in your homedir, but is fine with these files
being symlinks. As such, I instead create a subdir, ~/.bash
, and then symlink
~/.bashrc
to ~/.bash/bashrc
and ~/.bash_profile
to ~/.bash/bash_profile
. This
gives you a new namespace (the ~/.bash
dir) to pollute with little files, which we're
going to do plenty of below.
This file contains hidden or 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
function run(input, parameters) { | |
const appNames = []; | |
const skipAppNames = []; | |
const verbose = true; | |
const scriptName = 'close_notifications_applescript'; | |
const CLEAR_ALL_ACTION = 'Clear All'; | |
const CLEAR_ALL_ACTION_TOP = 'Clear'; | |
const CLOSE_ACTION = 'Close'; |
This file contains hidden or 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
public let null = NSNull() as AnyHashable | |
public enum JSONObject { | |
case array([Any]) | |
case dictionary([String: Any]) | |
case fragment(Any) | |
} | |
extension JSONObject { | |
@inlinable public static func with(_ data: Data, options: JSONSerialization.ReadingOptions = []) throws -> JSONObject { |
This file contains hidden or 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
public protocol OptionalProtocol: ExpressibleByNilLiteral { | |
associatedtype Wrapped | |
var wrapped: Wrapped? { get } | |
static var none: Self { get } | |
static func some(_ newValue: Wrapped) -> Self | |
func map<U>(_ f: (Wrapped) throws -> U) rethrows -> U? | |
func flatMap<U>(_ f: (Wrapped) throws -> U?) rethrows -> U? | |
} | |
extension Optional: OptionalProtocol { |
This file contains hidden or 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
@propertyWrapper | |
public struct Restorable<Value> { | |
public var wrappedValue: Value | |
public init(wrappedValue: Value, using undoManager: UndoManager = .init()) { | |
self.wrappedValue = wrappedValue | |
self.projectedValue = undoManager | |
} |
This file contains hidden or 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
/// Classes whose initializers actually create derived classes | |
protocol FactoryInitializable { | |
/// The type of the least-derived class declared to be FactoryInitializable. | |
/// | |
/// - Warning: Do not define this in your FactoryInitializable type! | |
associatedtype FactoryBase: AnyObject, FactoryInitializable = Self | |
// This associatedtype is a trick that captures `Self` at the point where | |
// `FactoryInitializable` enters a class hierarchy; in other contexts, `Self` | |
// refers to the most-derived type. | |
} |
This file contains hidden or 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 Foundation | |
extension Int { | |
func abbreviate() -> String { | |
typealias Abbrevation = (threshold: Double, divisor: Double, suffix: String) | |
let abbreviations: [Abbrevation] = [ | |
(0, 1, ""), | |
(1000.0, 1000.0, "K"), | |
(100_000.0, 1_000_000.0, "M"), |
This file contains hidden or 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 ruby | |
require 'json' | |
require 'fileutils' | |
notebook = File.expand_path('~/Desktop/NewSnippets.qvnotebook') | |
FileUtils.mkdir_p(notebook) | |
nbmeta = { | |
"name" => "NewSnippets", | |
"uuid" => %x{uuidgen}.strip |
This file contains hidden or 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
@propertyWrapper | |
public struct AnyProxy<EnclosingSelf, Value> { | |
private let keyPath: ReferenceWritableKeyPath<EnclosingSelf, Value> | |
public init(_ keyPath: ReferenceWritableKeyPath<EnclosingSelf, Value>) { | |
self.keyPath = keyPath | |
} | |
@available(*, unavailable, message: "The wrapped value must be accessed from the enclosing instance property.") | |
public var wrappedValue: Value { |
This file contains hidden or 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
local CATEGORY_EX_ICES = { | |
"codex", "murex", "silex", "vertex", "index" | |
} | |
local CATEGORY_IX_ICES = { | |
"matrix", "radix", "helix" | |
} | |
local CATEGORY_UM_A = { | |
"baterium", "agendum", "desideratum", "erratum", "stratum", "datum", "ovum", |