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
# Usage: | |
# 1. Put in your email/SendGrid credentials or phone/Twilio credentials | |
# 2. Run as: "bash rdv_naturalisation.sh nanterre" or "bash rdv_naturalisation.sh bobigny" or "bash rdv_naturalisation.sh cre" | |
# 3. Get your RDV! The script will dump the HTML of the page and will continue execution even after the first RDV is found. | |
SENDGRID_BEARER_TOKEN='' # should start with "SG." | |
SENDGRID_EMAIL='' # put your e-mail here | |
TWILIO_SID='' # should start with "AC" | |
TWILIO_AUTH_TOKEN='' | |
TWILIO_FROM_NUMBER='' # put your Twilio Trial Phone Number here, should start with + |
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
struct MultiTypeDictionary<Root> { | |
private var dict: [PartialKeyPath<Root>: Any] = [:] | |
// Called for non-optional properties | |
subscript<Value>(keyPath: KeyPath<Root, Value>) -> Value? { | |
get { dict[keyPath] as? Value } | |
set { dict[keyPath] = newValue } | |
} | |
// Called for optional properties |
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 Network | |
protocol ConnectionAttribute: Equatable { | |
init(path: NWPath) | |
} | |
class ConnectionObserver<T: ConnectionAttribute> { | |
var handler: ((T) -> Void)? | |
private var monitor: NWPathMonitor |
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
final class DeinitObserver { | |
private let key: String | |
private weak var target: AnyObject? | |
private let deinitHandler: () -> Void | |
deinit { | |
deinitHandler() | |
} | |
init(for target: AnyObject, deinitHandler: @escaping () -> Void) { |
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
class WeakObject<T: AnyObject>: Hashable { | |
private(set) weak var object: T? | |
let identifier: ObjectIdentifier | |
static func == (lhs: WeakObject<T>, rhs: WeakObject<T>) -> Bool { | |
return lhs.identifier == rhs.identifier | |
} | |
func hash(into hasher: inout Hasher) { | |
hasher.combine(identifier) |
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 | |
let clientJSON = """ | |
{ | |
"clients": [ | |
{ | |
"name": "John", | |
"amount": 1000 | |
}, | |
{ |