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
precedencegroup AssociativeComparisonPrecedence { | |
associativity: left | |
higherThan: ComparisonPrecedence | |
lowerThan: NilCoalescingPrecedence | |
} | |
infix operator <: AssociativeComparisonPrecedence | |
infix operator <=: AssociativeComparisonPrecedence | |
public func < <V: Comparable>(lhs: V, rhs: V) -> (Bool, V) { |
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 Collection { | |
func interpolated(by interpolation: (_ previous: Element, _ current: Element) throws -> Element) rethrows -> [Element] { | |
var iterator = makeIterator() | |
var result = [Element]() | |
guard var previous = iterator.next() else { | |
return [] | |
} |
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 pandas as pd | |
import argparse | |
def process_file(input_file_path, output_file_path): | |
# Read the file line by line until we find the header row starting with 'timestamp' | |
with open(input_file_path, 'r') as file: | |
lines = file.readlines() | |
# Get the line number where 'timestamp' is found |
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 Badge<V: View>: ViewModifier { | |
let badge: V | |
func body(content: Content) -> some View { | |
ZStack { | |
content | |
GeometryReader { [self] geometry in |
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
#!/bin/bash | |
set -e | |
echo " => Creating a temporary directory for codesigndoc ..." | |
temp_dir="$(mktemp -d -t codesigndocXXXXXX)" | |
codesigndoc_bin_path="${temp_dir}/codesigndoc" | |
version_to_use="2.3.1" | |
if [ "$1" != "" ] ; then | |
version_to_use="$1" |
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
let a: Int = 1 | |
let b: Double = 1 | |
let aa: AnyHashable = a | |
let ab: AnyHashable = b | |
aa == ab // 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
// Xcode 11.0 beta 2 まで | |
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { | |
// Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`. | |
// If using a storyboard, the `window` property will automatically be initialized and attached to the scene. | |
// This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead). | |
// Use a UIHostingController as window root view controller | |
let window = UIWindow(frame: UIScreen.main.bounds) | |
window.rootViewController = UIHostingController(rootView: ContentView(model: model)) | |
self.window = window |
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 | |
import SwiftUI | |
import Combine | |
protocol UsecaseProtocol: AnyObject { | |
var intPublisher: AnyPublisher<Int, Never> { get } | |
func reset() | |
} | |
struct ContentView : View { |
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
enum PopTeamEpic: String { | |
case po = "ポ" | |
case p = "プ" | |
case teame = "テピ" | |
case pic = "ピック" | |
} | |
struct 蒼井翔太: Sequence, IteratorProtocol { | |
mutating func next() -> PopTeamEpic? { | |
switch arc4random_uniform(4) { | |
case 0: return .po |
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
class Lazy <T> { | |
private var t: T? | |
private let initializer: () -> T | |
private let semaphore = DispatchSemaphore(value: 1) | |
init(_ initializer: @escaping () -> T) { | |
self.initializer = initializer |
NewerOlder