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 | |
/// An Equatable container for storing and accessing just the attributes of an NSAttributedString without | |
/// caring about the string itself. | |
struct TextAttributes: Equatable { | |
private var storage = NSMutableAttributedString(string: "") | |
mutating func setAttributes(_ attributes: [NSAttributedString.Key: Any], range: NSRange) { | |
preserveUniqueReferenceToStorageIfNecessary() | |
extendStringRangeIfNecessary(range: range) |
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 | |
protocol Placeholding { | |
static func placeholder() -> Self | |
} | |
struct PlaceholderArray<Element: Placeholding>: RandomAccessCollection { | |
typealias SubSequence = Slice<Self> | |
var startIndex: Int { indices.lowerBound } |
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 Combine | |
struct AwaitPublisher<Value>: Publisher { | |
typealias Output = Value | |
typealias Failure = Never | |
private let block: () async -> Value | |
init(block: @escaping () async -> Value) { | |
self.block = block |
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
// | |
// linked_list.c | |
// CLox | |
// | |
// Created by Dalton Claybrook on 8/13/21. | |
// | |
#include <stdlib.h> | |
#include <string.h> | |
#include "linked_list.h" |
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 | |
import libspacekit | |
public struct AstroPhoto: Equatable { | |
public let title: String | |
public let url: URL | |
} | |
private struct AstroPhotoContext { | |
let fetcher: AstroPhotoFetcher |
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 | |
private enum TimeoutResult<T> { | |
case success(T) | |
case timeout | |
} | |
struct TimeoutError: Error {} | |
/// Run an arbitrary async task that is cancelled after a provided timeout interval |
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
ACTION="build" | |
AD_HOC_CODE_SIGNING_ALLOWED="YES" | |
ALTERNATE_GROUP="staff" | |
ALTERNATE_MODE="u+w,go-w,a+rX" | |
ALTERNATE_OWNER="dalton.claybrook" | |
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES="NO" | |
ALWAYS_SEARCH_USER_PATHS="NO" | |
ALWAYS_USE_SEPARATE_HEADERMAPS="NO" | |
APPLE_INTERNAL_DEVELOPER_DIR="/AppleInternal/Developer" | |
APPLE_INTERNAL_DIR="/AppleInternal" |
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
#[macro_use] | |
extern crate lazy_static; | |
use regex::{Captures, Regex}; | |
use std::fs; | |
use std::ops::Range; | |
use std::str::FromStr; | |
#[derive(Debug)] | |
enum AdventError { | |
Unknown, |
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 RxSwift | |
/// This type is similar to `BehaviorRelay`, but it allows for mutating an element in-place | |
/// rather than assigning a new one. | |
/// | |
/// This is useful for large copy-on-write containers. For example, it's less expensive to append | |
/// an element to an `Array` with 1M entries than it is to make a new `Array` by concatenating it with | |
/// a second `Array` with one element. | |
public final class MutableRelay<Element>: ObservableType { | |
public private(set) var value: Element |
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
/// Types that implement this trait provide the rules | |
/// for replacing objects of the same type. | |
pub trait Replaceable { | |
type Key: Eq; | |
fn unique_key(&self) -> Self::Key; | |
fn should_replace(&self, other: &Self) -> bool; | |
} | |
/// Trait implemented for collections that can be | |
/// filtered using replacement rules |