Skip to content

Instantly share code, notes, and snippets.

View Iron-Ham's full-sized avatar

Hesham Salman Iron-Ham

View GitHub Profile
-------------------------------------
Translated Report (Full Report Below)
-------------------------------------
Incident Identifier: DBCFED02-37DF-4767-8900-50281E1B16B7
CrashReporter Key: 9C79CDBA-3A30-E13D-6B64-B7BA4A49D46E
Hardware Model: MacBookPro18,4
Process: AccessibilityUIServer [31288]
Path: /Applications/Xcode-14.1.0-Beta.3.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/CoreServices/AccessibilityUIServer.app/AccessibilityUIServer
Identifier: com.apple.AccessibilityUIServer
import SwiftUI
public struct RefreshableScrollView<Content, Value>: View where Content: View {
private let content: () -> Content
private let action: () async -> Value
init(@ViewBuilder content: @escaping () -> Content, action: @escaping () async -> Value) {
self.content = content
self.action = action
}
@Iron-Ham
Iron-Ham / Wrappers.swift
Last active August 26, 2024 13:53
Use property wrappers to ignore a variable for synthesized `Equatable` and `Hashable`.
import Foundation
@propertyWrapper
struct IgnoreEquatable<Wrapped>: Equatable {
var wrappedValue: Wrapped
static func == (lhs: IgnoreEquatable<Wrapped>, rhs: IgnoreEquatable<Wrapped>) -> Bool {
true
}
}
@Iron-Ham
Iron-Ham / ReusableView.swift
Last active May 15, 2017 23:05
A better way!
// Instantiating view controllers from a storybaord
let myStoryboard: UIStoryboard = ...
let myCustomViewController: MyCustomViewController = myStoryboard.instantiateViewControllerOfType(MyCustomViewController.self)
// Registration of a UITableViewCell
tableView.register(MyCustomCellType.self)
// Dequeueing of a UITableViewCell
let cell = tableView.dequeueReusableCell(for: indexPath) as MyCustomCellType
// Registration of a UICollectionViewCell
opt_in_rules:
- empty_count
- missing_docs
- redundant_nil_coalescing
- switch_case_on_newline
- nimble_operator
- force_unwrapping
- conditional_returns_on_newline
- closure_spacing
included:
# schedule = mapping function from time to temperature
func SIMULATED_ANNEALING(problem, schedule)
current <- MAKE_NODE(problem.INITIAL_STATE)
for t = 1 to INF do
T <- schedule(t)
if T = 0 then return current
next <- randomly selected successor of current
deltaE <- next.VALUE - current.VALUE
if deltaE > 0 then current <- next
@Iron-Ham
Iron-Ham / hill_climbing_pseudo.txt
Last active September 30, 2015 00:57
HillClimbPseudo.txt
func HILL_CLIMBING(problem):
current <- MAKE_NODE(problem.INITIAL_STATE)
loop do:
neighbor <- highest valued successor of current
if neighbor.VALUE <= current.VALUE then return current.STATE
current <- neighbor
@Iron-Ham
Iron-Ham / 8-queens-recursive-logic.txt
Created September 26, 2015 23:48
a description of the logic to calculate 8-queens solutions recursively.
ways to arrange 8 queens on an 8x8 board =
ways to arrange 8 queens on an 8x8 board with queen at (7,0)
ways to arrange 8 queens on an 8x8 board with queen at (7, 1)
ways to ... with queen at (7, 2)
ways to ... with queen at (7, 3)
ways to ... with queen at (7, 4)
ways to ... with queen at (7, 5)
ways to ... with queen at (7, 6)
ways to ... with queen at (7, 7)
= 8 branches