Skip to content

Instantly share code, notes, and snippets.

@GUIEEN
Last active January 25, 2022 06:40
Show Gist options
  • Save GUIEEN/0693b6009e79c882e55c5b15fc13cbeb to your computer and use it in GitHub Desktop.
Save GUIEEN/0693b6009e79c882e55c5b15fc13cbeb to your computer and use it in GitHub Desktop.

Revisions

  1. GUIEEN revised this gist Jan 25, 2022. 1 changed file with 18 additions and 0 deletions.
    18 changes: 18 additions & 0 deletions quadrantOf.swift
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,18 @@
    public func quadrantOf(x: Int, y: Int) -> String {
    var quadrant = ""

    switch (x, y) {
    case (1..., 1...):
    quadrant = "1"
    case (..<0, 1...):
    quadrant = "2"
    case (..<0, ..<0):
    quadrant = "3"
    case (1..., ..<0):
    quadrant = "4"
    default:
    quadrant = "boundary"
    }

    return quadrant
    }
  2. GUIEEN revised this gist Jan 24, 2022. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion log_with_time.swift
    Original file line number Diff line number Diff line change
    @@ -2,7 +2,7 @@ import Foundation
    let formatter = DateFormatter()
    formatter.dateFormat = "yyyy-MM-dd HH:mm:ss.SSS "

    func printLog(_ items: Any...) {
    func log_with_time(_ items: Any...) {
    print(formatter.string(from: Date()), terminator: "")
    for idx in items.indices {
    print(items[idx], terminator: idx == items.count-1 ? "\n" : " ")
  3. GUIEEN revised this gist Jan 24, 2022. 1 changed file with 4 additions and 2 deletions.
    6 changes: 4 additions & 2 deletions log_with_time.swift
    Original file line number Diff line number Diff line change
    @@ -2,7 +2,9 @@ import Foundation
    let formatter = DateFormatter()
    formatter.dateFormat = "yyyy-MM-dd HH:mm:ss.SSS "

    func log_with_time(_ log: Any...) {
    func printLog(_ items: Any...) {
    print(formatter.string(from: Date()), terminator: "")
    print(log)
    for idx in items.indices {
    print(items[idx], terminator: idx == items.count-1 ? "\n" : " ")
    }
    }
  4. GUIEEN created this gist Jan 24, 2022.
    8 changes: 8 additions & 0 deletions log_with_time.swift
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,8 @@
    import Foundation
    let formatter = DateFormatter()
    formatter.dateFormat = "yyyy-MM-dd HH:mm:ss.SSS "

    func log_with_time(_ log: Any...) {
    print(formatter.string(from: Date()), terminator: "")
    print(log)
    }