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 | |
| public func randomizeDurationSplits(group: DispatchGroup? = nil, completion: @escaping ([[Double]]) -> Void) { | |
| group?.enter() | |
| DispatchQueue.global().async { | |
| let dyad0harmony0: Double = Double.random(in: durationLowerBound ... durationUpperBound) | |
| var dyad1harmony0: Double = dyad0harmony0 | |
| repeat { |
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 CircularArrayView: View { | |
| private let diameter: CGFloat = 30 | |
| var numberOfCircles: Int = 12 | |
| var spacing: CGFloat = 1.0 | |
| // Ensures the number of circles is always even | |
| private var evenNumberOfCircles: Int { | |
| numberOfCircles % 2 == 0 ? numberOfCircles : numberOfCircles + 1 |
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
| func hueAccentColor(angle: CGFloat) -> Color { | |
| return Color(hue: CGFloat(angle / 360.0), saturation: 1.0, brightness: 1.0, opacity: 1.0) | |
| } | |
| func whiteColor() -> Color { | |
| return Color.init(uiColor: .white) // return Color(hue: CGFloat(hueAngle / 360.0), saturation: 0.0, brightness: 1.0, opacity: 1.0) | |
| } | |
| func blackColor() -> Color { | |
| return Color.init(uiColor: .black) // return Color(hue: CGFloat(hueAngle / 360.0), saturation: 0.0, brightness: 0.0, opacity: 1.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 SwiftUI | |
| struct ContentView: View { | |
| var body: some View { | |
| HueControlView() | |
| } | |
| } | |
| struct HueControlView: View { | |
| @State var hueAngle: CGFloat = 0.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
| // | |
| // ContentView.swift | |
| // AccessibilityColorPicker | |
| // | |
| // Created by Xcode Developer on 4/25/24. | |
| // | |
| import SwiftUI | |
| import UIKit | |
| import Observation |
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 requests | |
| from bs4 import BeautifulSoup | |
| import json | |
| def fetch_posts(url, visited_urls, base_url, file): | |
| if url in visited_urls: | |
| return | |
| print(f"Visiting {url}") | |
| visited_urls.add(url) |
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 | |
| import UIKit | |
| struct CustomUISlider: UIViewRepresentable { | |
| @Binding var value: Double | |
| var range: ClosedRange<Double> | |
| func makeUIView(context: Context) -> UISlider { | |
| let slider = UISlider(frame: .zero) | |
| slider.minimumTrackTintColor = UIColor.clear |
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
| .fileImporter(isPresented: $isImporting, allowedContentTypes: [.plainText], allowsMultipleSelection: false) { result in | |
| switch result { | |
| case .success(let urls): | |
| guard let url = urls.first else { return } | |
| do { | |
| // Ensure you have access to the resource | |
| guard url.startAccessingSecurityScopedResource() else { | |
| print("Access to the file was denied.") | |
| return | |
| } |
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 | |
| import UniformTypeIdentifiers | |
| struct MyStruct: Codable, Identifiable { | |
| let id: Int | |
| var name: String | |
| } | |
| struct ContentView: View { | |
| @State private var structs = [MyStruct]() |
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
| struct Assistant: Codable { | |
| let id: String | |
| } | |
| func getAssistant(globalData: GlobalData) { | |
| let url = URL(string: "https://api.openai.com/v1/assistants")! | |
| var request = URLRequest(url: url) | |
| request.httpMethod = "POST" | |
| request.addValue("application/json", forHTTPHeaderField: "Content-Type") |