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 HasEmptyInitializer { | |
init() | |
} | |
class HostingCollectionViewCell<Content, Model>: UICollectionViewCell where Content: View, Content: HasEmptyInitializer, Model: ObservableObject, Model: HasEmptyInitializer { | |
private lazy var view: Content = { Content() }() | |
lazy var model: Model = { Model() }() | |
lazy var hostingController: some UIViewController = { UIHostingController(rootView: view.environmentObject(model)) }() |
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
// | |
// TaggerView.swift | |
// | |
// Created by Alex Hay on 21/11/2020. | |
// | |
// Simple interface for adding tags to an array in SwiftUI | |
// Example video: https://imgur.com/gallery/CcA1IXp | |
// alignmentGuide code from Asperi @ https://stackoverflow.com/a/58876712/11685049 | |
import SwiftUI |
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 | |
#if os(macOS) | |
public typealias PlatformViewType = NSView | |
#elseif !os(watchOS) | |
import UIKit | |
public typealias PlatformViewType = UIView | |
#endif | |
#if !os(watchOS) |
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
// Don't forget to prefix your category! | |
#import <UIKit/UIKit.h> | |
NS_ASSUME_NONNULL_BEGIN | |
@interface UIWindow (PSPDFAdditions) | |
#if TARGET_OS_UIKITFORMAC |
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
// AppDelegate.swift: | |
// macCatalyst: Create menu | |
override func buildMenu(with builder: UIMenuBuilder) { | |
guard builder.system == .main else { return } | |
// The format menu doesn't make sense | |
builder.remove(menu: .format) | |
// Add Open command |
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
// The MIT License (MIT) | |
// | |
// Copyright (c) 2017 Alexander Grebenyuk (github.com/kean). | |
import Foundation | |
import Alamofire | |
import RxSwift | |
import RxCocoa | |
// This post is **archived**. For a modern version that uses Async/Await and Actors, see the new article |
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
// You have a very very large video file you need to upload to a server while your app is backgrounded. | |
// Solve by using URLSession background functionality. I will here use Alamofire to enable multipart upload. | |
class Networking { | |
static let sharedInstance = Networking() | |
public var sessionManager: Alamofire.SessionManager // most of your web service clients will call through sessionManager | |
public var backgroundSessionManager: Alamofire.SessionManager // your web services you intend to keep running when the system backgrounds your app will use this | |
private init() { | |
self.sessionManager = Alamofire.SessionManager(configuration: URLSessionConfiguration.default) | |
self.backgroundSessionManager = Alamofire.SessionManager(configuration: URLSessionConfiguration.background(withIdentifier: "com.lava.app.backgroundtransfer")) |
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
# The commands below are a guide to remove a large file that has been | |
# accidentally committed to a Git repository's history. If the file is | |
# larger than 100 MB, GitHub will prevent you from pushing your latest | |
# commits. The annotated steps below should help you remove the large | |
# file from your commit history, even if you've made new commit since. | |
# Some Git users advise against rebasing. You can safely use it here | |
# because you haven't published your changes yet. | |
# So, you first need to rebase your current branch onto the point that |
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
———————————————————————————————————————————————————————————————————————————————————————————————————— | |
BBEdit / BBEdit-Lite / TextWrangler Regular Expression Guide Modified: 2018/08/10 01:19 | |
———————————————————————————————————————————————————————————————————————————————————————————————————— | |
NOTES: | |
The PCRE engine (Perl Compatible Regular Expressions) is what BBEdit and TextWrangler use. | |
Items I'm unsure of are marked '# PCRE?'. The list while fairly comprehensive is not complete. |
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
<?php | |
/* Merge multiple RSS feeds with SimplePie | |
* | |
* Just modify the path to SimplePie and | |
* modify the $feeds array with the feeds you want | |
* | |
* You should probably also change the channel title, link and description, | |
* plus I added a CC license you may not want | |
* | |
* Help from: http://www.webmaster-source.com/2007/08/06/merging-rss-feeds-with-simplepie/ |
NewerOlder