This file contains 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
DATABASE_ID_KEY = "table_id" | |
DATABASE_PRIMATY_COLUMN = "reportCalendarId" | |
function main() { | |
} | |
function crawler() { | |
var calendarData = parseCalendarRow(); | |
var database = new Database(); | |
This file contains 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 String { | |
var length: Int { | |
return self.characters.count | |
} | |
fileprivate var short_url_length: Int { | |
return 23 | |
} |
This file contains 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
class MyClass<Item: CustomStringConvertible & Equatable> { | |
var item: Item | |
init(value: Item) { | |
self.item = value | |
} | |
} |
This file contains 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 | |
protocol A {} | |
protocol B: A {} | |
protocol Base { | |
var module: A { get} | |
} | |
extension Base { |
This file contains 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 NSObject { | |
struct AssociatedKeys { | |
static var disposeBagKey = "DisposeBagKey" | |
} | |
var disposeBag: DisposeBag { | |
get { | |
guard let bag = objc_getAssociatedObject(self, &type(of: self).AssociatedKeys.disposeBagKey) as? DisposeBag else { | |
let newDisposeBag = DisposeBag() | |
self.disposeBag = newDisposeBag | |
return newDisposeBag |
This file contains 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
enum Fruit { | |
case peach0 | |
.... | |
case peach253 | |
case peach254 | |
case peach255 | |
case peach256 | |
} | |
MemoryLayout<Fruit>.size // 2 |
This file contains 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
enum Fruit { | |
case peach | |
case apple | |
case grape | |
} | |
var aPeach = Fruit.peach | |
let aPeachPtr = withUnsafePointer(to: &aPeach) { UnsafeRawPointer($0) } |
This file contains 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
enum Fruit { | |
case peach | |
case apple | |
case grape | |
} | |
var i = 0 | |
var peachPtr = withUnsafePointer(to: &i) { UnsafeRawPointer($0) } |
This file contains 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
enum Fruit { | |
case peach | |
case apple | |
case grape | |
} | |
var i = 0 | |
var peachPtr = withUnsafePointer(to: &i) { UnsafeRawPointer($0) } |
This file contains 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
enum Fruit { | |
case peach | |
case apple | |
case grape | |
} | |
var i = 3 | |
var emptyEnumPtr = withUnsafePointer(to: &i) { UnsafeRawPointer($0) } | |
.bindMemory(to: Fruit.self, capacity: MemoryLayout<Fruit>.size) |