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 | |
extension View { | |
/// Applies the given transform or returns the untransformed view. | |
/// | |
/// Useful for availability branching on view modifiers. Do not branch with any properties that may change during runtime as this will cause errors. | |
/// - Parameters: | |
/// - transform: The transform to apply to the source `View`. | |
/// - Returns: The view transformed by the transform. | |
@ViewBuilder |
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 WaveformAnimation: View { | |
@State var waveformData: [CGFloat] = Array(repeating: 0, count: 40) | |
@State var startAnimation: Bool = false | |
@State var color: Color = Color(hex: "A28497") | |
var body: some View { | |
HStack(spacing: 4) { | |
ForEach(Array(waveformData.enumerated()), id: \.offset) { index, height in |
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
// | |
// MIT License | |
// | |
// Copyright (c) 2024 Sophiestication Software, Inc. | |
// | |
// 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
// | |
// OCXML.swift | |
// Created by Marco Arment on 9/23/24. | |
// | |
// Released into the public domain. Do whatever you'd like with this. | |
// No guarantees that it'll do anything, or do it correctly. Good luck! | |
// | |
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
extension StringProtocol { | |
/// str[NSRange(location:0, length: 9)] | |
subscript(_ range: NSRange) -> SubSequence { | |
guard let stringRange = Range<String.Index>(range, in: self) else { | |
fatalError("String index is out of range") | |
} | |
return self[stringRange] | |
} | |
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 XForm <Content>: View where Content: View { | |
let content: Content | |
init(@ViewBuilder content: () -> Content) { | |
self.content = content() | |
} | |
var body: some View { |
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 | |
// ObservableTester | |
// | |
// Created by Craig Hockenberry on 4/18/24. | |
// | |
import SwiftUI | |
class BackingStore { |
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 Point { | |
var position: CGPoint | |
var velocity: CGPoint | |
} | |
struct ContentView: View { | |
@State | |
var lines: [[Point]] = [] |
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 String { | |
/** | |
Sanitizes the string by obscuring sensitive information. | |
- Returns: A sanitized version of the string where sensitive information is replaced with `*******`. | |
This method searches for specific keys (namely `access_token`, `refresh_token`, and `id_token`) in various formats including JSON-like strings, query strings, HTTP headers, plain text, and also searches for email addresses. It replaces their associated values or the email addresses with a placeholder string to obscure sensitive information. | |
## Examples: | |
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
# 2023-11-27 MIT LICENSE | |
Here's the open source version of my ChatGPT game MonkeyIslandAmsterdam.com. | |
It's an unofficial image+text-based adventure game edition of Monkey Island in Amsterdam, my home town. | |
Please use it however you want. It'd be nice to see more ChatGPT-based games appear from this. If you get inspired by it, please link back to my X https://x.com/levelsio or this Gist so more people can do the same! | |
Send me your ChatGPT text adventure game on X, I'd love to try it! |
NewerOlder