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 UITextField { | |
func placeholder() -> UILabel? { | |
for subview in $0.subviews { | |
if let label = subview as? UILabel { | |
return label | |
} | |
} | |
return nil |
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 | |
extension Date { | |
static func isSameDay(date1: Date, date2: Date) -> Bool { | |
let diff = Calendar.current.dateComponents([.day], from: date1, to: date2) | |
if diff.day == 0 { | |
return true | |
} else { | |
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
import UIKit | |
extension UIColor { | |
convenience init(hexString: String) { | |
let hex = hexString.trimmingCharacters(in: CharacterSet.alphanumerics.inverted) | |
var int = UInt32() | |
Scanner(string: hex).scanHexInt32(&int) | |
let a, r, g, b: UInt32 | |
switch hex.count { | |
case 3: // RGB (12-bit) |
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 | |
class MyAwesomeClass: NSObject { | |
var a = "test" | |
} | |
var myClass = MyAwesomeClass() | |
var pointer = Unmanaged.passUnretained(myClass).toOpaque() |
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 turicreate as tc | |
#Here you should put path to images which already contains styles | |
style = tc.load_images('style/') | |
#Here you should put path to images which is used for train | |
content = tc.load_images('content/') | |
#Main function which train model| max_itearation should be find experimentaly | |
model = tc.style_transfer.create(style, content, max_iterations=50) | |
#Here you should put path to images which is used for test | |
test_images = tc.load_images('test/') | |
#Testing |