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
/*: | |
Joe Groff: | |
> In a lot of the ways people use dictionaries/maps/hashtables, there's a type dependency between | |
> the keys and values, but most mainstream typed languages provide homogeneously-typed maps. | |
> Are there any that try to preserve more interesting type relationships between key and value? | |
> https://twitter.com/jckarter/status/1278739951568314368 | |
> As one example, it's common for specific keys to be associated with specific types, like in | |
> {"name": "Tanzy", "age": 13}, "name" should always map to a string, and "age" to a number. |
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
#include "InputModeDetector.h" | |
#include "Input/Events.h" | |
FInputModeDetector::FInputModeDetector() | |
{ | |
// 4 local players should be plenty usually (will expand if necessary) | |
LastInputModeByPlayer.Init(EInputMode::Mouse, 4); | |
} | |
bool FInputModeDetector::HandleKeyDownEvent(FSlateApplication& SlateApp, const FKeyEvent& InKeyEvent) |
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
// Run any SwiftUI view as a Mac app. | |
import Cocoa | |
import SwiftUI | |
NSApplication.shared.run { | |
VStack { | |
Text("Hello, World") | |
.padding() | |
.background(Capsule().fill(Color.blue)) |
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
// | |
// ContentView.swift | |
// | |
// | |
// Created by Bernstein, Joel on 7/4/20. | |
// | |
import SwiftUI | |
struct ElementModel: Identifiable |
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
# Script to download all the WWDC 2020 session videos in the highest 4K video and audio | |
# You may have to update ffmpeg before using this script. I needed version 4.3 or higher to successfully download the videos. | |
# | |
# If you want the lower bitrate audio, do a find/replace of "audio_english_192" with "audio_english_64" | |
# If you want lower bitrate or lower resolution video, do a find/replace of "hvc_2160p_16800" with any of the following: | |
# "hvc_2160p_11600" | |
# "hvc_1440p_8100" | |
# "hvc_1080p_5800" | |
# "hvc_1080p_4500" | |
# "hvc_720p_3400" |
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
docker run -d \ | |
--restart=always \ | |
-p 33060:3306 \ | |
-e MYSQL_ROOT_PASSWORD=root \ | |
-v ~/docker/volumes/mysql:/var/lib/mysql \ | |
--name mysql-5.7 \ | |
mysql:5.7 \ | |
--sql-mode="NO_ENGINE_SUBSTITUTION" |
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 Contact: Decodable, CustomStringConvertible { | |
var id: String | |
@NestedKey | |
var firstname: String | |
@NestedKey | |
var lastname: String | |
@NestedKey | |
var address: String | |
enum CodingKeys: String, NestableCodingKey { |
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
protocol KeyPathUpdatable {} | |
extension KeyPathUpdatable { | |
func updating<LeafType>(_ keyPath: WritableKeyPath<Self, LeafType>, to value: LeafType) -> Self { | |
var copy = self | |
copy[keyPath: keyPath] = value | |
return copy | |
} | |
} |
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
// https://stackoverflow.com/a/45777692/5536516 | |
import Foundation | |
struct MemoryAddress<T>: CustomStringConvertible { | |
let intValue: Int | |
var description: String { | |
let length = 2 + 2 * MemoryLayout<UnsafeRawPointer>.size |
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 UIKit | |
// RawRepresentable and struct to get enum-like behavior that can be extended | |
// in other modules (frameworks for example). | |
public struct Config: RawRepresentable { | |
public typealias RawValue = String | |
public let rawValue: RawValue | |
public init(rawValue: String) { | |
self.rawValue = rawValue |