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 | |
| @IBDesignable | |
| class CustomView: UIView { | |
| @IBOutlet var contentView: UIView! | |
| override init(frame: CGRect) { | |
| super.init(frame: frame) | |
| commonInit() |
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
| private func initCollectionView() { | |
| let nib = UINib(nibName: "CustomCell", bundle: nil) | |
| collectionView.register(nib, forCellWithReuseIdentifier: "CustomCell") | |
| collectionView.dataSource = self | |
| } |
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 | |
| @IBDesignable | |
| class CustomView: UIView { | |
| @IBOutlet var contentView: UIView! | |
| @IBOutlet weak var collectionView: UICollectionView! | |
| override init(frame: CGRect) { | |
| super.init(frame: frame) |
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
| version: '3.3' | |
| services: | |
| db: | |
| image: mysql:5.7 | |
| volumes: | |
| - ./wordpress.sql:/docker-entrypoint-initdb.d/init.sql # prepopulate database | |
| - db_data:/var/lib/mysql # persist database data inside docker storage | |
| restart: always | |
| env_file: |
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
| MYSQL_ROOT_PASSWORD=somerootpassword | |
| MYSQL_DATABASE=wordpress | |
| MYSQL_USER=wordpress | |
| MYSQL_PASSWORD=wordpress |
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
| server { | |
| server_name nasulawesi.me www.nasulawesi.me; | |
| location /pma/ { | |
| proxy_pass http://localhost:8080/; | |
| } | |
| location / { | |
| proxy_pass http://localhost:8000; | |
| proxy_set_header Host $host; #necessary for wordpress |
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 fetchData(_ data: Int, delay: Double, completionHandler: @escaping (String)->()) { | |
| DispatchQueue.main.asyncAfter(deadline: .now() + delay) { | |
| completionHandler("\(data)") | |
| } | |
| } | |
| var text = "" | |
| for i in 0..<20 { | |
| fetchData(i, delay: Double.random(in: 0...0.2)) { | |
| text += "\($0) - " |
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 group = DispatchGroup() | |
| var text = "" | |
| for i in 0..<20 { | |
| group.enter() | |
| fetchData(i, delay: Double.random(in: 0...0.2)) { | |
| text += "\($0) - " | |
| group.leave() | |
| } | |
| } | |
| group.notify(queue: DispatchQueue.main) { |
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 Foundation | |
| func fetchData(_ data: Int, delay: Double, completionHandler: @escaping (String)->()) { | |
| DispatchQueue.main.asyncAfter(deadline: .now() + delay) { | |
| completionHandler("\(data)") | |
| } | |
| } | |
| DispatchQueue.global().async { | |
| let semaphore = DispatchSemaphore(value: 0) |
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 fetchData(_ data: Int, delay: Double, completionHandler: @escaping (String)->()) { | |
| DispatchQueue.main.asyncAfter(deadline: .now() + delay) { | |
| completionHandler("\(data)") | |
| } | |
| } |