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
| protocol Kesehatan { | |
| func memakaiMasker() | |
| func mencuciTangan() | |
| func menjagaJarak() | |
| func menjauhiKerumunan() | |
| func membatasiMobilisasi() | |
| } |
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
| const g29 = require('logitech-g29') | |
| const robot = require('robotjs') | |
| g29.on('shifter-gear', function(gear) { | |
| switch (gear) { | |
| case 0: | |
| break; | |
| case 1: | |
| robot.keyTap('v', ['command']); | |
| break; |
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
| protocol Kesehatan { | |
| func memakaiMasker() | |
| func menjagaJarak() | |
| func mencuciTangan() | |
| } | |
| class MauSehat: /* implements */ Kesehatan { | |
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
| extension CLGeocoder { | |
| func reverseGeocode(_ location: CLLocation) -> Promise<([CLPlacemark]?,Error?)> { | |
| return wrap { self.reverseGeocodeLocation(location, completionHandler: $0) } | |
| } | |
| // add some more here later | |
| } |
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
| // MARK: Singleton Instance | |
| private init() {} | |
| private static var instance: <#T#>! | |
| static var shared: <#T#> { | |
| if instance == nil { | |
| instance = <#T#>() | |
| } | |
| return instance | |
| } |
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
| let promise = Promise<<#T#>> { fulfill, reject in | |
| } | |
| return promise |
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
| extension <#_#>: UITableViewDataSource { | |
| func numberOfSections(in tableView: UITableView) -> Int { | |
| return 1 | |
| } | |
| func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { | |
| return <#models#>.count | |
| } | |
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
| extension UIView { | |
| func origin(in view: UIView) -> CGPoint { | |
| return view.convert(CGPoint.zero, from: self) | |
| } | |
| func isVisible(in view: UIView) -> Bool { | |
| return view.frame.contains(self.origin(in: view)) | |
| } | |
| } |
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 | |
| var str1 = "Hi" | |
| var str2 = "World" | |
| func twoString(s1: String, s2: String) -> String { | |
| let filtered = str1.filter { char in str2.contains(char) } | |
| let out = filtered.isEmpty ? "NO" : "YES" |