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
<?xml version="1.0" encoding="utf-8"?> | |
<configuration> | |
<packageSources> | |
<clear /> | |
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" /> | |
<add key="aspire" | |
value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet8/nuget/v3/index.json" /> | |
</packageSources> | |
<packageSourceMapping> |
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
chromium-browser --remote-debugging-port=9222 --user-data-dir="/home/[User]/Documents/ChromiumDataWebDriver" |
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
/ Prepare NSFetchedResultsController | |
fileprivate lazy var fetchedResultsController: NSFetchedResultsController<Article> = { | |
// Create Fetch Request | |
let fetchRequest: NSFetchRequest<Article> = Article.fetchRequest() | |
// Configure Fetch Request | |
fetchRequest.sortDescriptors = [NSSortDescriptor(key: #keyPath(Article.sourceName), ascending: true)] | |
// Create Fetched Results Controller | |
let fetchedResultsController = NSFetchedResultsController(fetchRequest: fetchRequest, managedObjectContext: self.persistentContainer.viewContext, sectionNameKeyPath: nil/*#keyPath(Article.sourceName)*/, cacheName: nil) |
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 | |
class JSONParser { | |
static func parse<T>(from localJSONFileName: String) throws -> T? where T: Decodable { | |
do { | |
let localFilePath = Bundle.main.path(forResource: localJSONFileName, ofType: "json")! | |
let jsonString = try NSString(contentsOfFile: localFilePath, encoding: String.Encoding.utf8.rawValue) | |
let jsonData = jsonString.data(using: String.Encoding.utf8.rawValue)! | |
let decoder = JSONDecoder() | |
let decodedData = try! decoder.decode(T.self, from: jsonData) |
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 | |
@IBDesignable | |
class TextFieldWithImage: UITextField { | |
override func leftViewRect(forBounds bounds: CGRect) -> CGRect { | |
return super.leftViewRect(forBounds: bounds) | |
} | |
@IBInspectable var leftImage: UIImage? { |
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
@echo off | |
:: BatchGotAdmin | |
:------------------------------------- | |
REM --> Check for permissions | |
IF "%PROCESSOR_ARCHITECTURE%" EQU "amd64" ( | |
>nul 2>&1 "%SYSTEMROOT%\SysWOW64\cacls.exe" "%SYSTEMROOT%\SysWOW64\config\system" | |
) ELSE ( | |
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system" | |
) |
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
//If you have 2 "rx" variables (drivers, observables etc) you can often chain them | |
//without a need to write code in subscribe close. For example: | |
someObject.loadingState | |
.drive(loadingStateMutable) | |
.disposed(by: disposeBag) | |
//This will apply values from someObject.loadingState to a loadingStateMutable variable in a viewModel |
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
// Prepare NSFetchedResultsController | |
fileprivate lazy var fetchedResultsController: NSFetchedResultsController<Article> = { | |
// Create Fetch Request | |
let fetchRequest: NSFetchRequest<Article> = Article.fetchRequest() | |
// Configure Fetch Request | |
fetchRequest.sortDescriptors = [NSSortDescriptor(key: #keyPath(Article.sourceName), ascending: true)] | |
// Create Fetched Results Controller | |
let fetchedResultsController = NSFetchedResultsController(fetchRequest: fetchRequest, managedObjectContext: self.persistentContainer.viewContext, sectionNameKeyPath: nil/*#keyPath(Article.sourceName)*/, cacheName: nil) |