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
| CVPixelBufferRef createCroppedPixelBufferBiPlanar(CVPixelBufferRef srcPixelBuffer, CGRect croppingRect, CGSize scaleSize) { | |
| OSType inputPixelFormat = CVPixelBufferGetPixelFormatType(srcPixelBuffer); | |
| assert(inputPixelFormat == kCVPixelFormatType_420YpCbCr8BiPlanarFullRange | |
| || inputPixelFormat == kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange); | |
| size_t inputWidth = CVPixelBufferGetWidth(srcPixelBuffer); | |
| size_t inputHeight = CVPixelBufferGetHeight(srcPixelBuffer); | |
| assert(CGRectGetMinX(croppingRect) >= 0); |
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 Darwin | |
| import Foundation | |
| import SystemPackage | |
| /// Utilities for intercepting the contents written to a file descriptor, useful for testing | |
| /// the output of command line utilities or programs that interact heavily with standard out on POSIX systems | |
| extension UnsafeMutablePointer where Pointee == FILE { | |
| /// Convenience method for intercepting the contents of a file descriptor as a String with the specified encoding | |
| func interceptString(encoding: String.Encoding = .utf8, _ intercepted: () -> Void) throws -> String? { |
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
| def service_bus_client(_fnc=None, conn_str: str = "", topic_name: str = ""): | |
| def decorate(decorated_func: Callable): | |
| topic_client = AsyncServiceBusTopicClient.from_connection_string( | |
| conn_str=conn_str, | |
| topic_name=topic_name, | |
| ) | |
| @wraps(decorated_func) | |
| async def wrapper(*args, **kwargs): |
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
| protocol FocusTracking<FocusField>: AnyObject { | |
| associatedtype FocusField: Hashable | |
| var focusedField: FocusField? { get set } | |
| } | |
| struct FocusTrackingView<Content, Target: FocusTracking>: View where Content: View, Target.FocusField: Hashable { | |
| @FocusState.Binding var focusedField: Target.FocusField? | |
| let content: Content | |
| let boundTo: Target |
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
| // | |
| // ContentView.swift | |
| // GoGoButtons | |
| // | |
| // Created by Allen Humphreys on 10/31/22. | |
| // | |
| import SwiftUI | |
| extension Color { |
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 SwiftUI | |
| @available(iOS 9999, *) | |
| @main | |
| struct ObservabilityApp: App { | |
| var body: some Scene { | |
| WindowGroup { | |
| ContentView() | |
| } | |
| } |
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
| os_log\(\s*".*"\s*,\nlog: ((self\.)?log), type: \.((fault|error|debug|info))[^\)]*\) | |
| os_log\(\s*".*"\s*,\s*log: ((self\.)?log),\s*type: \.((fault|error|debug|info))[^\)](?!=\n)*\) // figuring out the look ahead. Need to match all non ) that | |
| os_log\(\s*".*"\s*,\s*log: ((self\.)?log),\s*type: \.((fault|error|debug|info))([^\)]?!\)|(.|\n)* | |
| ([^\)]?!\)|(.|\n)* // match everything except close parethesis unless the close paren is not followed by a close paren | |
| // paren not preceded by a paren |
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
| // Button styles are necessarily exclusive. If you return a Button from `makeBody` | |
| // the next button style on the style stack | |
| public struct TrackedButtonStyle: PrimitiveButtonStyle { | |
| let action: () -> Void | |
| public func makeBody(configuration: Configuration) -> some View { | |
| Button { | |
| action() | |
| configuration.trigger() |
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 SwiftUI | |
| struct ContentView: View { | |
| @AppStorage("showAlignments") var showAlignments = true | |
| @AppStorage("showBorders") var showBorders = true | |
| @State var iconScale: Image.Scale = .large | |
| @State var fontStyle: Font.TextStyle = .body | |
| @State var icon: String = "square.and.arrow.up" | |
| let icons: [String] = ["square.and.arrow.up", "rectangle.and.pencil.and.ellipsis"] |
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 SwiftUI | |
| struct ContentView: View { | |
| var body: some View { | |
| VStack(alignment: .leading, spacing: 10) { | |
| Text("Plain HStack") | |
| HStack(alignment: .lastTextBaseline, spacing: 0) { | |
| Group { | |
| Label { | |
| Text("Filtersaf afdsa aallll.") |