Skip to content

Instantly share code, notes, and snippets.

View jaekong's full-sized avatar

Jae Kong jaekong

View GitHub Profile
@jaekong
jaekong / ErrorUIMiddleware.swift
Last active August 18, 2020 12:41
Vapor ErrorUIMiddleware - It's for Vapor 3. It is outdated, and likely not to work with Vapor 4.
import Vapor
public final class ErrorUIMiddleware: Middleware, Service {
private struct ErrorResponseBody {
private init() {}
static let templateKitError = errorMessage("UI rendering failed", "sorry, an error occured while rendering UI.")
static let errorMessage: (String, String...) -> String = { (title: String, messages: String...) in
var returnMessage = "<h1>\(title)</h1>"
@jaekong
jaekong / ThrowingUnwrapOperator.swift
Last active July 24, 2023 19:41
This piece of code introduces ..? operator which lets you handle unexpected nil found in an optional just like you would with any other Swift errors - with do/try/catch.
postfix operator ..?
extension Optional {
static postfix func ..? (optional: Optional<Wrapped>) throws -> Wrapped {
if let value = optional {
return value
} else {
throw OptionalUnwrapError.nilFound
}
}
@jaekong
jaekong / AudioBufferConversion.swift
Created August 10, 2019 14:38
AudioBuffer (or AVAudioPCMBuffer) to array of float / Float array to AudioBuffer (or AVAudioPCMBuffer)
import AVFoundation
extension AudioBuffer {
func array() -> [Float] {
return Array(UnsafeBufferPointer(self))
}
}
extension AVAudioPCMBuffer {
func array() -> [Float] {
@jaekong
jaekong / CollectionSplitInto.swift
Last active August 22, 2021 09:16
Info: This is now irrelevant since Swift Algorithms package now contains a chunks(ofCount:) method. A simple Swift extension to extend Collection protocol to have a split(into:) function. It is useful when you have to chunk an array or data to equal sized pieces.
// Info: This is now irrelevant since Swift Algorithms package now contains a chunks(ofCount:) method.
extension Collection where Index == Int {
func split(into size: Int) -> [Self.SubSequence] {
return stride(from: 0, to: count, by: size).map {
self[$0 ..< Swift.min($0 + size, count)]
}
}
}
@jaekong
jaekong / ByteToString.swift
Created August 18, 2020 16:39
Small Swift extension for getting proper binary representation of UInt8.
extension UInt8 {
var binaryRepresentation: String {
get {
let number = String(self, radix: 2)
let padding = String(repeating: "0", count: leadingZeroBitCount)
return String(padding + number)
}
}
}
@jaekong
jaekong / RequestOK.swift
Created January 20, 2021 09:04
A simple extension for Vapor 4 to tell if the request was accepted or not.
import Vapor
extension ClientResponse {
var ok: Bool {
get {
return self.status.code >= 200 && self.status.code < 300
}
}
}
@jaekong
jaekong / CRUDController.swift
Last active April 16, 2021 15:26
CRUD Controller protocol for Vapor 4 and Swift 5.2. It adds basic REST API for CRUD-ing any model with an UUID identifier. It is based on the default controller example, but has not been tested yet. A controller struct can conform to this protocol by adding typealias M for your Model, and adding a variable called path that determines subpath of …
import Fluent
import Vapor
protocol CRUDController: RouteCollection {
associatedtype M: Model, Content where M.IDValue == UUID
var path: [PathComponent] { get set }
init()
}

최재원(이하 '개발자')은(는) 「개인정보 보호법」 제30조에 따라 정보주체의 개인정보를 보호하고 이와 관련한 고충을 신속하고 원활하게 처리할 수 있도록 하기 위하여 다음과 같이 개인정보 처리방침을 수립·공개합니다.

○ 이 개인정보처리방침은 2023년 1월 1부터 적용됩니다.

제1조(개인정보의 처리 목적)

최재원(이하 '개발자')은(는) 다음의 목적을 위하여 개인정보를 처리합니다. 처리하고 있는 개인정보는 다음의 목적 이외의 용도로는 이용되지 않으며 이용 목적이 변경되는 경우에는 「개인정보 보호법」 제18조에 따라 별도의 동의를 받는 등 필요한 조치를 이행할 예정입니다.

  1. 재화 또는 서비스 제공

Privacy Policy

Jaewon Choi built the Isotope app as a Commercial app. This SERVICE is provided by Jaewon Choi and is intended for use as is.

This page is used to inform visitors regarding my policies with the collection, use, and disclosure of Personal Information if anyone decided to use my Service.

If you choose to use my Service, then you agree to the collection and use of information in relation to this policy. The Personal Information that I collect is used for providing and improving the Service. I will not use or share your information with anyone except as described in this Privacy Policy.

The terms used in this Privacy Policy have the same meanings as in our Terms and Conditions, which are accessible at Isotope unless otherwise defined in this Privacy Policy.

-------------------------------------
Translated Report (Full Report Below)
-------------------------------------
Process: Godot [30717]
Path: /Applications/Godot.app/Contents/MacOS/Godot
Identifier: org.godotengine.godot
Version: 4.2.1 (4.2.1)
Code Type: ARM-64 (Native)
Parent Process: launchd [1]