Skip to content

Instantly share code, notes, and snippets.

View drewster99's full-sized avatar

Andrew Benson drewster99

View GitHub Profile
@drewster99
drewster99 / main.md
Created September 15, 2025 03:24 — forked from CaptainCrouton89/main.md
Main Output Style I Use with CC
name description
main
Tweaked for orchestration and preferred programming practices

You are a senior software architect with deep expertise in system design, code quality, and strategic agent orchestration. You provide direct engineering partnership focused on building exceptional software through precise analysis and optimal tool usage.

Core Approach

Extend Before Creating: Search for existing patterns, components, and utilities first. Most functionality already exists—extend and modify these foundations to maintain consistency and reduce duplication. Read neighboring files to understand conventions.

@drewster99
drewster99 / userAgent.swift
Created May 20, 2021 17:00
Swift - Generates a suitable UserAgent string on iOS / macOS / tvOS
static let userAgent: String = {
let info = Bundle.main.infoDictionary
let executable = (info?[kCFBundleExecutableKey as String] as? String) ??
(ProcessInfo.processInfo.arguments.first?.split(separator: "/").last.map(String.init)) ??
"Unknown"
let bundle = info?[kCFBundleIdentifierKey as String] as? String ?? "Unknown"
let appVersion = info?["CFBundleShortVersionString"] as? String ?? "Unknown"
let appBuild = info?[kCFBundleVersionKey as String] as? String ?? "Unknown"
@drewster99
drewster99 / iosFrameworkVersions.swift
Created January 25, 2021 16:33
Swift iOS Xcode get and print all dynamic framework versions at runtime
// iosFrameworkVersions.swift
//
// Created by Andrew Benson (@DrewsterBenson) on 1/11/2021.
// Copyright (C) 2021 Andrew Benson.
// License: MIT (https://opensource.org/licenses/MIT)
//
// Stick in AppDelegate to dump all your (non-Apple) framework versions, like this:
//
// Framework versions:
// Alamofire -- 4.9.0(1)
@drewster99
drewster99 / AutoResizeViewControllerForKeyboard.swift
Last active January 25, 2021 16:44
Move views out of the way when keyboard appears, Swift 4.1, using Auto-Layout / Interface Builder / Storyboard
{
// Move views when keyboard appears/disappears
// Snipped from ViewController.swift
// This constraint should be tied to the top superview or safe area in Storybaord
@IBOutlet weak var closeButtonTopConstraint: NSLayoutConstraint!
private var topConstraintOriginalConstant: CGFloat?
private var topConstraintScrolledConstant: CGFloat = 0