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
// | |
// ContentView.swift | |
// UnicodeExplorer | |
// | |
// Created by David Albert on 5/1/24. | |
// | |
import SwiftUI | |
struct ContentView: View { |
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
// Cursed! Do not use! | |
// Supports most, but not all Text initializers. | |
import SwiftUI | |
extension FormatStyle { | |
func format(any value: Any) -> FormatOutput? { | |
if let v = value as? FormatInput { | |
return format(v) |
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
// miniKanren.swift, written by David Albert, and released into the public domain. | |
// | |
// An implementation of the miniKanren relational programming language. Somewhat | |
// reductively, relational programs can be run both forwards and backwards. In | |
// addition to asking "what does this function return when passed these arguments," | |
// you can also ask "what arguments to this function return the following value?" | |
// This lets you ask questions like like "what pairs of numbers sum to 12," which | |
// if you allow for negative numbers has an infinite number of solutions. | |
// | |
// Some mind bending miniKanren programs that others have written include: a |
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 Cocoa | |
class MyAutoscrollingView: NSView { | |
override func mouseDown(with event: NSEvent) { | |
// mouseDown-specific logic here | |
var mouseEvent = event | |
var done = false | |
NSEvent.startPeriodicEvents(afterDelay: 0.1, withPeriod: 0.05) |
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
########################################### | |
# IMPORTANT NOTE: | |
# | |
# As of asuswrt-merlin 380.67 Beta, you | |
# can now configure SSL certificates from | |
# the Webui, making these instructions | |
# unnecessary. | |
########################################### | |
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 UniformTypeIdentifiers | |
// As of macOS 14.3 | |
extension UTType { | |
static var allTypes: [UTType] { | |
[ | |
.item, | |
.content, | |
.compositeContent, | |
.diskImage, |
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
// | |
// OnWindowClose.swift | |
// | |
// Created by David Albert on 12/16/23. | |
// | |
import SwiftUI | |
import AppKit | |
struct WindowReader: NSViewRepresentable { |
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
extension Range where Bound == Int { | |
init<Summary>(_ range: Range<BTreeNode<Summary>.Index>, in root: BTreeNode<Summary>) where Summary: BTreeSummary { | |
range.lowerBound.validate(for: root) | |
range.upperBound.validate(for: root) | |
self = range.lowerBound.position..<range.upperBound.position | |
} | |
} |
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
extension Chunk { | |
mutating func fixup(withPrevious prev: Chunk) -> Bool { | |
var i = string.startIndex | |
var first: String.Index? | |
var old = startBreakState | |
var new = prev.endBreakState | |
startBreakState = new |
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
#!/bin/sh | |
# For Ubiquiti EdgeOS | |
# | |
# This script creates a directory /config/scripts/post-commit.d. Any script you put | |
# in that directory will get run every time you commit a new configuration. | |
# | |
# Installation: | |
# - Put this script in /config/scripts/post-config.d. Note that this is a different | |
# directory from the directory this creates. |
NewerOlder