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
#include <stdio.h> | |
#include <string.h> | |
#include <stdlib.h> | |
// https://adventofcode.com/2020/day/23 | |
int lut[1000001]; | |
int current = 0; | |
void setup(const char *numbers) { |
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 | |
public struct Shimmer: AnimatableModifier { | |
private let gradient: Gradient | |
@State private var position: CGFloat = 0 | |
public var animatableData: CGFloat { | |
get { position } |
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 AdSupport | |
import AppTrackingTransparency | |
struct ContentView: View { | |
@State private var trackingStatus: String = "" | |
@State private var idfa: String = "" | |
func updateIdfa() { |
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 | |
@main | |
struct WatchOS_CounterApp: App { | |
@AppStorage("counter") var counter = 0 | |
var body: some Scene { | |
WindowGroup { | |
VStack { | |
Text("\(counter)") |
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
// Based on this StackOverflow answer: https://stackoverflow.com/a/61273595/4239752 | |
import Foundation | |
import Combine | |
extension Publisher { | |
/// collects elements from the source sequence until the boundary sequence fires. Then it emits the elements as an array and begins collecting again. | |
func buffer<T: Publisher, U>(_ boundary: T) -> AnyPublisher<[Output], Failure> where T.Output == U { | |
let subject = PassthroughSubject<[Output], Failure>() |
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
extension Dictionary { | |
/// Merges two dictionaries. | |
/// When a key is present in both dictionaries, `lhs`'s keys are overwritten | |
/// | |
/// - Parameters: | |
/// - lhs: The base dictionary. Its keys may be overwritten by `rhs`'s keys | |
/// - rhs: The added dictionary. Its keys may overwrite `lhs`'s keys | |
static func + (lhs: [Key: Value], rhs: [Key: Value]) -> [Key: Value] { | |
return lhs.merging(rhs, uniquingKeysWith: { $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
import UIKit | |
import ObjectiveC | |
private typealias GestureClosure = (UIGestureRecognizer) -> Void | |
private var handle: UInt8 = 0 | |
extension UIGestureRecognizer { | |
/** | |
Initialize a UIGestureRecognizer (or subclass) with a closure |