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
// | |
// ColorFloodExample.swift | |
// ColorFloodExample | |
// | |
// Created by Stephan Casas on 6/28/23. | |
// | |
import SwiftUI; | |
import Accelerate; | |
import CoreGraphics; |
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 SwiftUI | |
@main | |
struct ExampleApp: App { | |
var body: some Scene { | |
WindowGroup { | |
ContentView() | |
} | |
} | |
} |
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
// | |
// SwiftUI_NSAlertExampleApp.swift | |
// SwiftUI_NSAlertExample | |
// | |
// Created by Stephan Casas on 6/20/23. | |
// | |
// This example requires the [NSViewProxy](https://github.com/stephancasas/NSViewProxy) | |
// package to acquire the pre-draw window context in `ContentView`. | |
// |
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
#!/usr/bin/env osascript -l JavaScript | |
function run(argv) { | |
ObjC.bindFunction('NSColorGetUserAccentColor', ['int', []]); | |
ObjC.bindFunction('NSColorSetUserAccentColor', ['bool', ['int']]); | |
console.log($.NSColorGetUserAccentColor()); | |
console.log($.NSColorSetUserAccentColor(4)); | |
return 0; |
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
#!/usr/bin/env osascript -l JavaScript | |
const CERT_PATH = '/tmp/sim-cert-install.pem'; | |
// NOTE: This is intended to be used as an Alfred Workflow. | |
// If you don't have Alfred, just replace the value of | |
// `argv` with the URL for the site whose root trust | |
// needs to be added. | |
function run([argv = '']) { |
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
#!/usr/bin/env osascript -l JavaScript | |
const App = Application.currentApplication(); | |
App.includeStandardAdditions = true; | |
function run(_) { | |
const finderPrefs = $.NSMutableDictionary.dictionaryWithContentsOfFile( | |
`${$.NSHomeDirectory().js}/Library/Preferences/com.apple.finder.plist`, | |
); |
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
// | |
// main.m | |
// EscapedUnicodeCharConvertExample | |
// | |
// Created by Stephan Casas on 5/22/23. | |
// | |
#import <Foundation/Foundation.h> | |
NSString* escapedUnicharToString(NSString* escapedUnicharString) { |
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
#!/usr/bin/env osascript -l JavaScript | |
const $attr = Ref(); | |
const $windows = Ref(); | |
const $children = Ref(); | |
const UNICODE_PATTERN = '11110xxx10xxxxxx10xxxxxx10xxxxxx'; | |
function run(_) { | |
const app = $.AXUIElementCreateApplication( |
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
#!/usr/bin/env osascript -l JavaScript | |
/** | |
* ----------------------------------------------------------------------------- | |
* Toggle Do Not Disturb Mode from Control Center | |
* ----------------------------------------------------------------------------- | |
* | |
* Created on May 18, 2023 by Stephan Casas | |
* | |
* Options: |
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
#!/usr/bin/env osascript -l JavaScript | |
const $attr = Ref(); | |
const $windows = Ref(); | |
const $children = Ref(); | |
function run(_) { | |
// Get TextMate AXUIElement | |
const textmatePid = | |
$.NSRunningApplication.runningApplicationsWithBundleIdentifier( |