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
struct AutoID: Hashable { | |
private var parent: AnyHashable? | |
private var file: String | |
private var line: UInt | |
private var column: UInt | |
init(parent: AnyHashable? = nil, file: String = #file, line: UInt = #line, column: UInt = #column) { | |
self.parent = parent | |
self.file = file | |
self.line = line |
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
on run argv | |
tell application "Mail" to activate | |
tell application "System Events" | |
keystroke "p" using command down | |
delay 2 | |
keystroke tab | |
keystroke tab |
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 View { | |
func hide(_ hide: Bool) -> some View { | |
HideableView(isHidden: .constant(hide), view: self) | |
} | |
func hide(_ isHidden: Binding<Bool>) -> some View { | |
HideableView(isHidden: isHidden, view: self) | |
} | |
} |
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 | |
struct SimpleTab<SelectionValue: Equatable & Hashable>: View, Identifiable { | |
var id: SelectionValue | |
var image: Image | |
var label: Text | |
var content: AnyView | |
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
const https = require("https"); | |
function fetchStatusCode(url) { | |
return new Promise(function(resolve, reject) { | |
const req = https.request(url, res => { | |
resolve(res.statusCode); | |
}); | |
req.on("error", error => { | |
reject(error); | |
}); |
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 binascii, base64 | |
from cryptography.hazmat.backends import default_backend | |
from cryptography.hazmat.primitives import hashes | |
from cryptography.hazmat.primitives.asymmetric import ec | |
from cryptography.hazmat.primitives.serialization import Encoding, PublicFormat, load_pem_public_key, PrivateFormat, load_pem_private_key, NoEncryption | |
from cryptography.hazmat.primitives.kdf.x963kdf import X963KDF | |
from cryptography.hazmat.primitives.ciphers.aead import AESGCM |
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/swift | |
import Foundation | |
struct Config { | |
enum Environment: String { | |
case dev | |
case prod | |
} | |
var environment: Environment = .prod |
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
// | |
// ASN1.swift | |
// ASN1 | |
// | |
// Created by Håvard Fossli on 29.08.2018. | |
// Copyright © 2018 Håvard Fossli. All rights reserved. | |
// | |
import Foundation |
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
// | |
// Author: Håvard Fossli <hfossli@agens.no> | |
// | |
// Copyright (c) 2018 Agens AS (http://agens.no/) | |
// | |
// Permission is hereby granted, free of charge, to any person obtaining a copy | |
// of this software and associated documentation files (the "Software"), to deal | |
// in the Software without restriction, including without limitation the rights | |
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
// copies of the Software, and to permit persons to whom the Software is |
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 xcrun swift | |
import Darwin | |
import Foundation | |
struct ANSIColors { | |
static let clear = "\u{001B}[0m" | |
static let red = "\u{001B}[38;5;160m" | |
static let orange = "\u{001B}[38;5;202m" | |
static let yellow = "\u{001B}[38;5;220m" |
NewerOlder