This file contains 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 XCTest | |
import Testing | |
final class MixedSwiftTestingXCTestTests: XCTestCase { | |
func testShouldntRecordFailure() { | |
XCTExpectFailure("This should fail") | |
XCTFail("This should fail") | |
} | |
} |
This file contains 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 Observation | |
enum State<T> { | |
case loading | |
case loaded(T) | |
case failed(String) | |
} | |
@MainActor | |
final class ArtistsController { |
This file contains 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 Dispatch | |
// A simple app to verify https://mastodon.social/@calicoding/112118821467209266 | |
// Allows you to check using Swift Tasks, or Dispatch Queues. | |
// | |
// I found this to not be the case, but maybe this isn't realistic? | |
// When compiled on Xcode 15.3 (either debug or release) and run on iOS 17.4, | |
// background QoS tasks are still executed even when Low Power Mode is enabled. |
This file contains 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 Combine | |
class FakeCall<T> { | |
private(set) var calls = [T]() | |
func record(_ arguments: T) { | |
calls.append(arguments) | |
} | |
func reset() { |
This file contains 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 UIKit | |
extension UIView { | |
func removeAllSubviews() { | |
for view in self.subviews { | |
view.removeFromSuperview() | |
} | |
} | |
@discardableResult |
This file contains 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
// Quick and dirty CSV parser I wrote. Handles edge cases badly. Doesn't perform well. Doesn't handle large csv files. | |
// But, hey, it solved my use case! | |
// Swift 4.2+ | |
func parseCSVBadly(csvData: Data) -> [[String]] { | |
guard let csv = String(data: csvData, encoding: .utf8) else { return [] } | |
return csv.components(separatedBy: CharacterSet.newlines).compactMap { line in | |
guard !line.hasPrefix("#") else { return nil } | |
return line.components(separatedBy: ",") | |
} |
This file contains 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
--- | |
name: concourse | |
director_uuid: RESULT OF bosh status --uuid | |
releases: | |
- name: concourse | |
version: latest | |
- name: garden-runc | |
version: latest |
This file contains 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
// I spent 2 hours working on this before I gave up. This is what I had when I declared it not worth the effort. | |
import Quick | |
import Nimble | |
import ReactiveCocoa | |
import CarthageKit | |
import OHHTTPStubs | |
class NetworkSpec: QuickSpec { | |
override func spec() { |
This file contains 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
homeassistant: | |
name: Apartment | |
latitude: [Redacted] | |
longitude: [Redacted] | |
temperature_unit: F | |
time_zone: America/Los_Angeles | |
customize: | |
scene.romantic: | |
friendly_name: "Romantic" | |
scene.lights_on: |
This file contains 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 ==(a: Polynomial, b: Polynomial) -> Bool { | |
return a.description == b.description | |
} |
NewerOlder