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
// more info at this post: https://blog.dave256apps.com/2025/01/05/textexpander-javascript-snippets.html | |
function capitalizeFirstLetter(input) { | |
// Capitalize the first letter and append the rest of the string | |
return input.charAt(0).toUpperCase() + input.slice(1); | |
} | |
let filename = "%filltext:name=filename:width=20%"; | |
let capitalizedFilename = capitalizeFirstLetter(filename); | |
let output = `#!/usr/bin/env python3 |
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 IntPair: CustomStringConvertible { | |
let x: Int | |
let y: Int | |
var product: Int { x * y } | |
var description: String { "(\(x), \(y))"} | |
} | |
enum MulParser { |
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
// modification of the sending example from @mattmassicotte's post here: | |
// https://www.massicotte.org/step-by-step-reading-from-storage | |
import SwiftUI | |
class DataModel { | |
var name: String | |
init(name: String) { | |
self.name = name |
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
// Created by David M Reed on 4/1/21. (not an April Fool's joke) | |
// https://blog.dave256apps.com | |
// thanks to the talk.objc.io and swiftbysundell.com for inspiring these ideas with their content | |
import SwiftUI | |
typealias UpdateWidthFunction = ((CGFloat?) -> Void) | |
typealias UpdateHeightFunction = ((CGFloat?) -> Void) | |
typealias UpdateSizeFunction = ((CGSize) -> Void) |
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
// | |
// ContactCell.swift | |
// ContactsCollectionView | |
// | |
// Created by David M Reed on 12/15/20. | |
// | |
import UIKit | |
class ContactCell: UICollectionViewListCell { |
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
// | |
// AddContactViewController.swift | |
// ContactsCollectionView | |
// | |
// Created by David M Reed on 12/15/20. | |
// | |
import UIKit | |
class AddContactViewController: UIViewController { |
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
// | |
// StatefulPreviewWrapper.swift | |
// Do It | |
// | |
// Created by Jim Dovey on 10/11/19. | |
// Copyright © 2019 Jim Dovey. All rights reserved. | |
// | |
import SwiftUI | |
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) |
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 Combine | |
struct APIError: Decodable, Error { | |
let statusCode: Int | |
} | |
// publisher code based on code in Practical Combine by Donny Wals | |
extension Decodable { |
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 <string> | |
class EmailAddress { | |
public: | |
EmailAddress(std::string name, std::string kind="home"); | |
std::string address() const { return _email; } | |
std::string kind() const { return _kind; } | |
private: | |
std::string _email; |
NewerOlder