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
//: HashMap data structure | |
public struct HashMap<Key: Hashable, Value> { | |
typealias Element = (key: Key, value: Value) | |
var arraySize: Int | |
var numberInserted = 0 | |
var array: [Element?] | |
var loadFactor: Double { | |
return Double(numberInserted) / Double(arraySize) | |
} |
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 axios from "axios"; | |
const singleton = Symbol(); | |
const singletonEnforcer = Symbol(); | |
function readCookie(name) { | |
const match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)')); | |
return (match ? decodeURIComponent(match[3]) : null); | |
} |
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 SwiftUI | |
struct PhotoView: View { | |
@State var scale: CGFloat = 1 | |
@State var scaleAnchor: UnitPoint = .center | |
@State var lastScale: CGFloat = 1 | |
@State var offset: CGSize = .zero | |
@State var lastOffset: CGSize = .zero | |
@State var debug = "" |