Skip to content

Instantly share code, notes, and snippets.

View Ksen17's full-sized avatar
🚀
Working on project

Ilia Stukalov Ksen17

🚀
Working on project
View GitHub Profile
import UIKit
extension UITextField {
func placeholder() -> UILabel? {
for subview in $0.subviews {
if let label = subview as? UILabel {
return label
}
}
return nil
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
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)
import UIKit
class MyAwesomeClass: NSObject {
var a = "test"
}
var myClass = MyAwesomeClass()
var pointer = Unmanaged.passUnretained(myClass).toOpaque()
@Ksen17
Ksen17 / TuryStyleTransfer.py
Last active August 26, 2018 18:12
Code for training style transfer model and converting it to Core ML format
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