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 Foundation | |
import SnapshotTesting | |
import XCTest | |
func assertBundledSnapshot<Value, Format>( | |
of value: @autoclosure () throws -> Value, | |
as snapshotting: Snapshotting<Value, Format>, | |
named name: String? = nil, | |
record recording: Bool? = nil, | |
timeout: TimeInterval = 5, |
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 Foundation | |
#if canImport(DeveloperToolsSupport) | |
import DeveloperToolsSupport | |
#endif | |
#if SWIFT_PACKAGE | |
private let resourceBundle = Foundation.Bundle.module | |
#else | |
private class ResourceBundleClass {} | |
private let resourceBundle = Foundation.Bundle(for: ResourceBundleClass.self) |
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 base64 | |
import os | |
from openai import OpenAI | |
from dotenv import load_dotenv | |
load_dotenv() | |
count = 50 | |
start_duration = 1 | |
mid_duration = 0.2 |
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
/// A macro that produces an expression to initialize an `IntegerPair` after validating that the bit | |
/// width of `Second` is a positive multiple of `First`. | |
@freestanding(expression) | |
public macro IntegerPair<First: UnsignedInteger, Second: UnsignedInteger>( | |
_ firstType: First.Type, | |
_ secondType: Second.Type | |
) -> IntegerPair<First, Second> = #externalMacro(module: "BitWidthMacros", type: "IntegerPairMacro") |
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 { useEffect, useRef, useState } from 'react'; | |
interface ElementSize<T extends HTMLElement> extends Size { | |
ref: React.RefObject<T>; | |
} | |
interface Size { | |
width: number; | |
height: number; | |
} |
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
#!/bin/bash | |
yum -y install \ | |
git \ | |
gcc-c++ \ | |
libcurl-devel \ | |
libedit-devel \ | |
libuuid-devel \ | |
libxml2-devel \ | |
ncurses-devel \ |
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 { | |
@State private var leftCounter = 1 | |
@State private var rightCounter = 1 | |
var body: some View { | |
VStack(spacing: 10) { | |
HStack { | |
Text("\(leftCounter)") |
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
@available(macOS 12.0, iOS 15.0, tvOS 15.0, watchOS 8.0, *) | |
private func stringFromDateStyle(storage: Any) -> String? { | |
let dateStyleChildren = Array(Mirror(reflecting: storage).children) | |
guard dateStyleChildren.count == 2, let text = dateStyleChildren[0].value as? Text else { | |
return nil | |
} | |
let textStorage = Array(Mirror(reflecting: text).children)[0].value // Text.Storage | |
let dateTextStorage = Array(Mirror(reflecting: textStorage).children)[0].value | |
guard "\(type(of: dateTextStorage))" == "DateTextStorage" else { |
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 Foundation | |
import Kingfisher | |
final class ImageLoader { | |
private let imageCache: ImageCache | |
init() throws { | |
self.imageCache = try Self.loadImageCache() | |
} |
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
// Created by Dalton Claybrook on 8/1/23. | |
import Foundation | |
struct Backoff { | |
enum RetryPolicy { | |
case indefinite | |
case maxAttempts(Int) | |
} |
NewerOlder