This file contains hidden or 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
| var _accessibilityLabel: String? = "" | |
| override var accessibilityLabel: String? { | |
| get { | |
| _accessibilityLabel | |
| } | |
| set { | |
| print("[x] accessibilityValue: [\(_accessibilityLabel ?? "nil")] => [\(newValue ?? "nil")]") | |
| _accessibilityLabel = newValue | |
| } | |
| } |
This file contains hidden or 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 | |
| extension UIAccessibilityTraits: @retroactive CustomStringConvertible { | |
| public var description: String { | |
| var traits = [String]() | |
| if contains(.none) { traits.append("none") } | |
| if contains(.button) { traits.append("button") } | |
| if contains(.link) { traits.append("link") } | |
| if #available(iOS 6.0, *) { | |
| if contains(.header) { traits.append("header") } |
This file contains hidden or 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
| // .─────────────────────. | |
| // _.───' `────. | |
| // ,' `. | |
| // ( init(next/1: ℕ[m]; P/1: ∑[m]) ) | |
| // '─. ,─' | |
| // `────. _.───' | |
| // `──────────┬────────' | |
| // │ | |
| // ┌─────────────────────────┴──────────────────────┐ | |
| // │ next[1] := i := 0; j := 1 │ |
This file contains hidden or 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
| struct Observable<T> { | |
| typealias ChangeHandler = (_ oldValue: T, _ newValue: T) -> Void | |
| var value: T { | |
| didSet { | |
| notifySubscribers(oldValue: oldValue, newValue: value) | |
| } | |
| } | |
| internal init(_ value: T) { |
This file contains hidden or 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
| func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool { | |
| let currentText = textField.text! as NSString | |
| let newText = currentText.replacingCharacters(in: range, with: string) | |
| textField.text = newText | |
| return false | |
| } |
This file contains hidden or 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
| #!/bin/sh | |
| # Calling this script: | |
| # gitrenamebransh.sh <remote_name> <old_branch_name> <new_branch_name> | |
| # Rename the local branch to the new name | |
| git branch -m $2 $3 | |
| # Delete the old branch on remote - where <remote> is, for example, origin | |
| git push $1 --delete $2 |
This file contains hidden or 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
| #!/bin/sh | |
| git rm -r --cached . | |
| git add . | |
| git commit -m "Fixed Gitignore" |
This file contains hidden or 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
| sudo xcode-select --reset | |
| swift build |
This file contains hidden or 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
| func determineLongestItem<T>(in matrix: [[T]]) -> Int { | |
| var maxLength = 0 | |
| for item in matrix { | |
| if item.count > maxLength { | |
| maxLength = item.count | |
| } | |
| } | |
| return maxLength | |
| } |
This file contains hidden or 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
| <style>pre { background-color: #1a1a1a; border: 0px solid #ccc; padding: 0px; margin-bottom: 0px; } pre code { display: block; color: #a9bcbc; line-height: 1.4em; font-size: 0.95em; white-space: pre; } pre code .keyword { color: #e73289; } pre code .type { color: #8281ca; } pre code .call { color: #348fe5; } pre code .property { color: #21ab9d; } pre code .number { color: #db6f57; } pre code .string { color: #fa641e; } pre code .comment { color: #6b8a94; } pre code .dotAccess { color: #92b300; } .box { padding: 20px; margin: 0 auto; display: block; border-radius: 8px; background-color: #1a1a1a; border: 0px solid #ccc; } </style> | |
| <!--Generate code at: https://splash.rambo.codes/ and then COPY HTML--> | |
| <section class="box"><pre><code><!--Paste the generated code after this--><!--Paste the generated code before this--></code></pre></section> |
NewerOlder