Setup Cmd+[left|right] and Option+[left|right] mac shortcuts for iTerm2
StackOverflow question with its answer: https://stackoverflow.com/questions/6205157/how-to-set-keyboard-shortcuts-to-jump-to-beginning-end-of-line
| For | Action | Send |
|---|
| const calcularDigito = (str, peso) => { | |
| var soma = 0; | |
| var indice = str.length - 1; | |
| var digito; | |
| while (indice >= 0) { | |
| digito = parseInt(str.substring(indice, indice + 1)); | |
| soma += digito * peso[peso.length - str.length + indice]; | |
| indice-- |
| infix operator ?!: NilCoalescingPrecedence | |
| @_transparent | |
| public func ?!<T: OptionalType>(value: T, error: @autoclosure () -> Error) throws -> T.ValueType { | |
| if let value = value.optionalValue { return value } | |
| throw error() | |
| } |
| // | |
| // UIViewController+ext.swift | |
| // Antony Alkmim | |
| // | |
| // Created by Antony Alkmim on 03/07/18. | |
| // Copyright © 2018 Antony Alkmim. All rights reserved. | |
| // | |
| import UIKit |
| // | |
| // SwipeableCell.swift | |
| // Antony Alkmim | |
| // | |
| // Created by Antony Alkmim on 09/07/18. | |
| // Inspired by: https://www.raywenderlich.com/62435/make-swipeable-table-view-cell-actions-without-going-nuts-scroll-views | |
| // | |
| import UIKit | |
| import PINRemoteImage |
| // The trick is to link the DeviceSupport folder from the beta to the stable version. | |
| // sudo needed if you run the Mac App Store version. Always download the dmg instead... you'll thank me later :) | |
| // Support iOS 13.2 devices (Xcode 11.2) with Xcode 11.1: | |
| sudo ln -s /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/13.2 /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport | |
| // Xcode 10.3 to Xcode 11 | |
| sudo ln -s /Applications/Xcode-11.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/13.0 /Applications/Xcode-10.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport | |
| // Then restart Xcode and reconnect your devices. You will need to do that for every beta of future iOS versions |
| #!/bin/bash | |
| echo "Removing unavailable simulators..." | |
| xcrun simctl delete unavailable | |
| echo "Brew cleanup..." | |
| brew cleanup | |
| echo "Removing Xcode Caches..." | |
| rm -rf ~/Library/Caches/com.apple.dt.Xcode |
| typealias IfResultClosure<Result> = (() -> Result) | |
| typealias Case<Value, Result> = (Value, IfResultClosure<Result>) | |
| @_functionBuilder | |
| struct CaseBuilder<Value, Result> { | |
| static func buildBlock(_ cases: Case<Value, Result>...) -> [Case<Value, Result>] { | |
| cases | |
| } | |
| } |
| import SwiftUI | |
| struct CurrencyTextField: View { | |
| let title: String | |
| @Binding var amountString: String | |
| var body: some View { | |
| TextField(title, text: $amountString) | |
| .keyboardType(.numberPad) |
Setup Cmd+[left|right] and Option+[left|right] mac shortcuts for iTerm2
StackOverflow question with its answer: https://stackoverflow.com/questions/6205157/how-to-set-keyboard-shortcuts-to-jump-to-beginning-end-of-line
| For | Action | Send |
|---|
| import UIKit | |
| import SwiftUI | |
| extension UIViewController { | |
| /// Add a SwiftUI `View` as a child of the input `UIView`. | |
| /// - Parameters: | |
| /// - swiftUIView: The SwiftUI `View` to add as a child. | |
| /// - view: The `UIView` instance to which the view should be added. | |
| func addSubview<Content>(_ swiftUIView: Content, to view: UIView) where Content: View { |