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
// Setup | |
class Child: ObservableObject { | |
@Published var value = "" | |
} | |
class Parent: ObservableObjectContainer { | |
let single = Child() | |
let array = [Child(), Child()] | |
func updateSingle() { |
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 Foundation | |
import SwiftUI | |
extension EnvironmentValues { | |
public func value<T>(_: T.Type = T.self, forKey key: String) -> T? { | |
guard let value = first(where: { name($0, equals: key) }) else { | |
print("No EnvironmentValue with key '\(key)' found.") | |
return nil | |
} |
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
@available(macOS 10.15, *) | |
extension NSEvent { | |
static func publisher(scope: Publisher.Scope, matching: EventTypeMask) -> Publisher { | |
return Publisher(scope: scope, matching: matching) | |
} | |
public struct Publisher: Combine.Publisher { | |
public enum Scope { | |
case local, global | |
} |
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 Foundation | |
// MARK: - typed predicate types | |
public protocol TypedPredicateProtocol: NSPredicate { associatedtype Root } | |
public final class CompoundPredicate<Root>: NSCompoundPredicate, TypedPredicateProtocol {} | |
public final class ComparisonPredicate<Root>: NSComparisonPredicate, TypedPredicateProtocol {} | |
// MARK: - compound operators |
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/sh | |
alias js-eval="osascript -l JavaScript -e" | |
# examples: | |
js-eval "1+1" | |
# 2 | |
js-eval "Math.PI" |
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
#!/usr/bin/env bash | |
# | |
# Author: Stefan Buck | |
# License: MIT | |
# https://gist.github.com/stefanbuck/ce788fee19ab6eb0b4447a85fc99f447 | |
# | |
# | |
# This script accepts the following parameters: | |
# | |
# * owner |
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
// USAGE ------ | |
// ============ | |
var shell = require('./shellHelper'); | |
// execute a single shell command | |
shell.exec('npm test --coverage', function(err){ | |
console.log('executed test'); | |
}}); |