Skip to content

Instantly share code, notes, and snippets.

View bonoogi's full-sized avatar

구본욱 Finn bonoogi

View GitHub Profile
@bonoogi
bonoogi / gist:80a6ced9c26fb6f5a24da56c21e0932c
Created July 20, 2023 10:30
앱 패키지 내에 존재하는 Asset.car 파일 분석하기
// 이렇게 실행하면 asset-info.json 파일 안에 Assets 저장 정보가 나타남
> xcrun --sdk iphoneos assetutil --info Assets.car > asset-info.json
@bonoogi
bonoogi / CustomEquatablePropertyWrapper.swift
Last active July 5, 2023 09:21
Equatable 구현에 도움을 주기 위한 프로퍼티 래퍼
@propertyWrapper struct IgnoreEquatable<Value>: Equatable {
var wrappedValue: Value
static func == (lhs: IgnoreEquatable<Value>, rhs: IgnoreEquatable<Value>) -> Bool {
true
}
}
@propertyWrapper struct CustomEquatable<Value>: Equatable {
var wrappedValue: Value
@bonoogi
bonoogi / macOS Internals.md
Created May 16, 2023 03:55 — forked from kconner/macOS Internals.md
macOS Internals

macOS Internals

Understand your Mac and iPhone more deeply by tracing the evolution of Mac OS X from prelease to Swift. John Siracusa delivers the details.

Starting Points

How to use this gist

You've got two main options:

@bonoogi
bonoogi / QuickSort.swift
Last active August 15, 2022 02:08
지겨운 정렬 알고리즘...넣어두고 필요할떄 꺼내먹자
func quickSort(_ array: [Int]) -> [Int] {
guard array.count > 1 else { return array }
let pivot = array.first!
var left = [Int]()
var right = [Int]()
for i in 1..<array.count {
let value = array[i]
if value < pivot {
@bonoogi
bonoogi / kr_won_to_backquote.sh
Created July 19, 2022 01:28 — forked from redism/kr_won_to_backquote.sh
macOS Sierra에서 원화(₩) 대신 백 쿼트(`) 입력하기
#!/bin/bash
if [ -f ~/Library/KeyBindings/DefaultkeyBinding.dict ]; then
echo "~/Library/KeyBindings/DefaultkeyBinding.dict already exists"
exit -1
fi
mkdir -p ~/Library/KeyBindings
cat << EOF > ~/Library/KeyBindings/DefaultkeyBinding.dict
{
"₩" = ("insertText:", "\`");
@bonoogi
bonoogi / String+HTML.swift
Last active May 24, 2021 08:11 — forked from nathanfjohnson/String+HTML.swift
Decoding HTML Entities in Swift 4
// Swift 4
// Check out the history for contributions and acknowledgements.
extension String {
/// Returns a new string made by replacing all HTML character entity references with the corresponding character.
/// decode per unicode because ;️(utf-16 `\u003b\ufe0a`) but i need find ;(utf-8 `\u003b`).
/// - Returns: decoded string
func decodingHTMLEntities() -> String {
let scalars = unicodeScalars
// https://leetcode.com/problems/set-matrix-zeroes/
class Solution {
func setZeroes(_ matrix: inout [[Int]]) {
if matrix.isEmpty {
return
}
var points = [(Int, Int)]()
let rows = matrix.count
let columns = matrix[0].count
class Solution {
func arrangeCoins(_ n: Int) -> Int {
let sq = Int(sqrt(Double(n * 2)))
let diff = sq * (sq + 1) / 2
if n >= diff {
return sq
} else {
return sq - 1
}
}
/*
* Copyright (C) 2016 Jeff Gilfelt.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$