For a simple element type, pros & cons
struct Model {
let id: String
let title: String
| #!/bin/bash | |
| # GitHub PR Tree Visualizer | |
| # | |
| # This script creates a hierarchical tree view of open GitHub pull requests, | |
| # showing their dependency relationships based on base branches. It provides | |
| # visual indicators for PR activity and highlights your current working branch. | |
| # | |
| # Features: | |
| # - Tree structure showing PR dependencies (which PRs are based on which branches) |
| #!/bin/bash | |
| # GitHub PR Tree Visualizer | |
| # | |
| # This script creates a hierarchical tree view of open GitHub pull requests, | |
| # showing their dependency relationships based on base branches. It provides | |
| # visual indicators for PR activity and highlights your current working branch. | |
| # | |
| # Features: | |
| # - Tree structure showing PR dependencies (which PRs are based on which branches) |
| # Install | |
| # - Add this function to ~/.zprofile (login shells) or ~/.zshrc (interactive shells). | |
| # - Append directly and reload: | |
| # curl -fsSL https://gist.github.com/hannesoid/8a624f61a847e8ec6237ec92de44e786/raw/gws.zsh >> ~/.zprofile && source ~/.zprofile | |
| # - Or save as ~/bin/gws.zsh and source it from your shell init. | |
| # | |
| # gws — Git Worktree Switcher (zsh) | |
| # | |
| # Features |
| // (c) Hannes Oud @hannesoid | |
| /// Hosts a SwiftUI view for use as an`inputAccessoryView` | |
| /// | |
| /// - Implements a subclass of `UIInputViewController`, this allows setting it as `UITextView.inputAccessoryViewController` | |
| /// - Has as a `.view` a `UIView` subclass that provides a `.intrinsicContentSize` which returns the height of a SwiftUI view | |
| /// - Has a `UIHostingViewController` subclass as a child view controller. Invalidates the `.view`'s `intrinsicContentSize` when the SwiftUI view layouts, in order to inform the system to update the size of the `inputAccessoryView` | |
| /// | |
| /// **Usage** | |
| /// |
This only happens on iOS 15 and only when building with Xcode 13. UITableView with (non-diffable) UITableViewDataSource and just one cell type.
The set up where the issues arises is, we have a row in which we are editing text, insert another after it, and want to continue editing in the new row.
Then we call insertRows(at: [.init(row: 1, section:0)], with: …).
Within UITableViewDataSource.tableView(…, cellForRowAt:) we correctly get tableView do dequeue a new instance cell_1. (side note: all cells have same reuseIdentifier). In the same tableView(…, cellForRowAt:) method we configure the cell's textView to become the new firstResponder.
| // | |
| // Locked.swift | |
| // | |
| // | |
| // Created by Hannes Oud on 29.11.19. | |
| // Helpful reading https://www.vadimbulavin.com/swift-atomic-properties-with-property-wrappers/ | |
| import Foundation | |
| /// Atomically locks a property using `os_unfair_lock` |
| #!/bin/bash | |
| ### Get my uid | |
| UserID=`id -u` | |
| echo "Your UID: ${UserID}" | |
| ### Unload root process | |
| sudo launchctl unload /Library/LaunchDaemons/com.antelopeaudio.daemon.plist | |
| ### Kill the process if it was already awaken |
| import SwiftUI | |
| final class SomeClass { | |
| static var instanceNr: Int = 0 | |
| init(_ owner: String) { | |
| SomeClass.instanceNr += 1 | |
| print("Created new instance (nr. \(SomeClass.instanceNr)) for owner \(owner)") | |
| } |
| # Copy this into you .bashrc or similar | |
| # Pull current & base branch, then merge-in base | |
| gitupdatefrom() { | |
| echo "➖ Pull current branch…" | |
| git pull | |
| echo "➖ Pull $1…" | |
| git fetch origin "$1":"$1" | |
| echo "➖ Merge $1 into current branch…" | |
| git merge "$1" |