Skip to content

Instantly share code, notes, and snippets.

View LukasCZ's full-sized avatar

Lukáš Petr LukasCZ

View GitHub Profile
import SwiftUI
class MyModel: ObservableObject {
@Published var attempted: Bool = false
@Published var firstname: String = "" {
didSet { updateDismissability() }
}
@Published var lastname: String = "" {
@RockinPaul
RockinPaul / sourceTree_device_not_configured.txt
Last active April 15, 2024 18:35
SourceTree: Device not configured (on MacOS)
In console:
git config credential.helper
You will see: osxkeychain
git config credential.helper sourcetree
Then if you perform git config credential.helper again
You will see: sourcetree
@ole
ole / core-data-backup.swift
Last active January 1, 2024 16:52
How to make a copy of a Core Data SQLite database. See https://oleb.net/blog/2018/03/core-data-sqlite-backup/ for more.
import CoreData
import Foundation
/// Safely copies the specified `NSPersistentStore` to a temporary file.
/// Useful for backups.
///
/// - Parameter index: The index of the persistent store in the coordinator's
/// `persistentStores` array. Passing an index that doesn't exist will trap.
///
/// - Returns: The URL of the backup file, wrapped in a TemporaryFile instance
@stephanecopin
stephanecopin / LICENSE
Created April 20, 2016 03:04
Animate NSFetchedResultsController changes when setting the fetch request's predicate or sortDescriptors property
The MIT License (MIT)
Copyright (c) 2016 Fueled
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
furnished to do so, subject to the following conditions:
var fetchedResultsProcessingOperations: [NSBlockOperation] = []
private func addFetchedResultsProcessingBlock(processingBlock:(Void)->Void) {
fetchedResultsProcessingOperations.append(NSBlockOperation(block: processingBlock))
}
func controller(controller: NSFetchedResultsController, didChangeObject anObject: AnyObject, atIndexPath indexPath: NSIndexPath?, forChangeType type: NSFetchedResultsChangeType, newIndexPath: NSIndexPath?) {
switch type {
case .Insert:
#!/bin/bash
function usage {
echo "Usage: $0 -c [CodeSign Directory] -p [Xcode Project File.xcodeproj]"
echo "If any arguments are not specified, defaults will be attempted. If defaults don't exist, script will exit."
echo "OPTIONS:"
echo " -c [CodeSign Directory]: Location of directory containing project's provisioning profiles."
echo " -p [Xcode Project File]: Path of Xcode project directory (the .xcodeproj, not .pbxproj)"
echo " -b: Use PlistBuddy command for UUID replacement instead of sed. (Better handling of a couple of edge cases, but makes diffs impossible to read.)"
echo " -v: Verbose logging."