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
{ | |
"annotations": { | |
"list": [ | |
{ | |
"builtIn": 1, | |
"datasource": { | |
"type": "grafana", | |
"uid": "-- Grafana --" | |
}, | |
"enable": true, |
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 | |
struct ImagePlaceholder: View { | |
var body: some View { | |
ZStack { | |
Rectangle() | |
.foregroundColor(Color(UIColor.systemGray3)) | |
.aspectRatio(4/3, contentMode: .fill) | |
Image(systemName: "xmark.rectangle") |
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 | |
extension Publisher where Output: Sequence { | |
func sequence() -> Publishers.FlatMap<Publishers.Sequence<Self.Output, Self.Failure>, Self> { | |
self.flatMap { Publishers.Sequence(sequence: $0) } | |
} | |
} | |
let publisher = PassthroughSubject<Array<Int>, Never>() | |
publisher |
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
// | |
// SortDescriptor.swift | |
// MyTubePlayer | |
// | |
// Created by Lars Stegman on 04/12/2018. | |
// Copyright © 2018 Stegman. All rights reserved. | |
// | |
import Foundation |
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
extension ISO8601DateFormatter { | |
/// Parses an ISO8601 time interval string | |
/// For example: P5DT19H6M15S represents 5 days 19 hours 6 minutes and 15 seconds. | |
/// PT4M5S represents 4 minutes and 5 seconds | |
/// M and S are mandatory. | |
/// | |
/// - Parameter from: An ISO8601 interval string. | |
/// - Returns: The time interval in seconds that the string represents (if it's valid) | |
func interval(from: String) -> TimeInterval? { | |
let regex = try! NSRegularExpression(pattern: "P((?<d>[0-9]+)D)?T((?<h>[0-9]+)H)?((?<m>[0-9]+)M)((?<s>[0-9]+)S)") |