Skip to content

Instantly share code, notes, and snippets.

View daniel-beard's full-sized avatar

Daniel Beard daniel-beard

View GitHub Profile
#!/usr/bin/env xcrun -sdk macosx swift
// Displays UI in an NSWindow which can interact with the commandline
// Usage: `echo "Bar" | ./swift-ui-commandline-tool.swift`
import Foundation
import SwiftUI
extension CommandLine {
static let input: String = { AnyIterator { readLine() }.joined() }()
@ChrisPenner
ChrisPenner / Optics Cheatsheet.md
Last active August 12, 2025 12:57
Optics Cheatsheet
@tonyarnold
tonyarnold / RangeReplaceableCollectionOperators.swift
Created August 25, 2020 13:29
Use this to add an operator to append items to sequences, ie: `collection += item`
extension RangeReplaceableCollection {
static func += (collection: inout Self, element: Element) {
collection.append(element)
}
static func += (collection: inout Self, element: Element?) {
if let element = element {
collection.append(element)
}
}
@amirdew
amirdew / ModifyCodable.swift
Last active May 29, 2024 06:05
Modifying private and immutable properties (let) in Codable instances
import Foundation
extension Decodable where Self: Encodable {
/// Creates a new instance and changes the value for the provided key.
///
/// - Parameters:
/// - key: The key path to the property that you want to modify.
/// Use period to separate levels and [] for indexes.
/// Examples: "id", "name.firstName", "children[2].name.firstName"
///
@Njengah
Njengah / claude-code-hooks-example.json
Last active July 10, 2025 14:42
Claude Code Hooks Examples
{
"hooks": {
"PostToolUse": [
{
"matcher": "Write|Edit",
"hooks": [
{
"type": "command",
"command": "~/scripts/doc-generator.sh"
}
@zoltan-magyar
zoltan-magyar / xcode-claude-code-third-party.md
Last active July 30, 2026 00:26
Xcode Claude Code integration with third-party APIs

Setting Up Xcode Claude Code with Third-Party API Endpoints

This guide explains how to configure Xcode's built-in Claude Code integration to work with third-party API endpoints instead of the official Anthropic API. You need macOS 26.2+ and Xcode 26.3+ for the Claude Code integration.

Step 1: Install Claude Code component in Xcode

You need to first install Xcode's own Claude Code instance, with its own Claude Code binary.

Xcode Settings -> Intelligence -> Anthropic -> Claude Agent -> press Get button