Skip to content

Instantly share code, notes, and snippets.

View Morbix's full-sized avatar

Henrique Morbin Morbix

  • iFood
  • Porto, Portugal
  • 07:28 (UTC +01:00)
View GitHub Profile
@Morbix
Morbix / gist:cc8807d21a383d639143acf9cf580138
Created June 28, 2017 12:52
UITextField with multiple lines
extension UITextField {
// Works only if the UITextField don't have the focus and have some text,
// so prefer call this in the didEndEditing event.
func setNumberOfLines(_ numberOfLines: Int, lineBreakMode: NSLineBreakMode) {
self.subviews.forEach { subview in
guard let label = subview as? UILabel else { return }
label.lineBreakMode = lineBreakMode
label.numberOfLines = numberOfLines
}
open -a Atom ~/.gitconfig
let frameworkBundle = Bundle(for: IniciaisImageView.self)
guard let bundleURL = frameworkBundle.resourceURL?.appendingPathComponent("AgiplanUtils.bundle") else { return }
let resourceBundle = Bundle(url: bundleURL)
guard let view = resourceBundle?.loadNibNamed("IniciaisImageView", owner: self, options: nil)?.first as? UIView else {
return
}
@Morbix
Morbix / gist:69bb6320e971bfe3e6d2d8e7b4669ab1
Created July 26, 2017 12:22
Link to get kml from Google Maps
http://www.google.com/maps/d/u/0/kml?forcekml=1&mid=14eieZr331zbNk2zfPIWdT4fHY_c
protocol CloudTagViewDelegate {
func cloud(_ cloud: CloudTagView, tagTouched tag: TagView)
func cloud(_ cloud: CloudTagView, tagDismissed tag: TagView)
}
@Morbix
Morbix / gist:408251ddcdbf442dc99dcfc481123bfd
Created October 3, 2018 12:48
Não deixar o app abrir a cena se estiver rodando os testes unitários.
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
if ProcessInfo().environment["XCInjectBundleInto"] != nil { return true }
...
}
public class Main {
public static void main(String[] args) {
Veiculo f1 = new CarroF1();
f1.acelera(10);
f1.acelera(10);
f1.freia(50);