윗첨자는 ^
string ^
아랫첨자는 ~
string ~
으로 하면 됩니다.
종종 호환이 안될 경우가 많은데, 이럴때는 그대로
HTML tag 인 <sup>
, <sub>
를 쓰면 됩니다.
마크다운 문법, 정말 간단하지만 구글링을 해도 뭔가 좀 애매합니다. 설명이 다르거나 부족하거나 저 같은 초보자가 보고 배우기 애매한 경우가 좀 있었습니다. 그래서 저 스스로의 마크다운 문법 공부를 위한 실습 겸 가이드를 위해 문법정리를 작성해 보고자 합니다. 참고로 이 정리는 깃허브에서 사용하는 것을 전제로 합니다.
먼저 제목입니다. 제목을 쓰는 방법은 두 가지로 나눌 수 있습니다.
extension UILabel { | |
func textWidth() -> CGFloat { | |
return UILabel.textWidth(label: self) | |
} | |
class func textWidth(label: UILabel) -> CGFloat { | |
return textWidth(label: label, text: label.text!) | |
} | |
class func textWidth(label: UILabel, text: String) -> CGFloat { |
// swift/stdlib/public/runtime/Metadata.cpp をプリプロセッサのみ実行した結果から抜粋 | |
struct ValueWitnessTable; | |
namespace value_witness_types { | |
typedef OpaqueValue * (*initializeBufferWithCopyOfBuffer) (ValueBuffer *, ValueBuffer *, const Metadata *); | |
typedef void (*destroy) (OpaqueValue *, const Metadata *); | |
typedef OpaqueValue * (*initializeWithCopy) (OpaqueValue *, OpaqueValue *, const Metadata *); | |
typedef OpaqueValue * (*assignWithCopy) (OpaqueValue *, OpaqueValue *, const Metadata *); | |
typedef OpaqueValue * (*initializeWithTake) (OpaqueValue *, OpaqueValue *, const Metadata *); |
// macOS x86_64 syscall works as follows: | |
// Syscall id is moved into rax | |
// 1st argument is moved into rdi | |
// 2nd argument is moved into rsi | |
// 3rd argument is moved into rdx | |
// ... plus some more | |
// Return value is stored in rax (where we put syscall value) | |
// Mac syscall enum that contains the value to correctly call it | |
enum Syscall: Int { |
/*: | |
This is a concept re-implementation of the @Binding and @State property wrappers from SwiftUI | |
The only purpose of this code is to implement those wrappers myself | |
just to understand how they work internally and why they are needed, | |
⚠️ This is not supposed to be a reference implementation nor cover all | |
subtleties of the real Binding and State types. | |
The only purpose of this playground is to show how re-implementing | |
them myself has helped me understand the whole thing better |
struct LazyView<Content: View>: View { | |
let build: () -> Content | |
init(_ build: @autoclosure @escaping () -> Content) { | |
self.build = build | |
} | |
var body: Content { | |
build() | |
} | |
} |
import Combine | |
import CoreData | |
public final class FetchedResultsPublisher | |
<ResultType> | |
: Publisher | |
where | |
ResultType: NSFetchRequestResult | |
{ | |
import Foundation | |
final class FileIO { | |
private let buffer:[UInt8] | |
private var index: Int = 0 | |
init(fileHandle: FileHandle = FileHandle.standardInput) { | |
buffer = Array(try! fileHandle.readToEnd()!)+[UInt8(0)] // 인덱스 범위 넘어가는 것 방지 |
// Don't forget to add to the project: | |
// 1. DeepLabV3 - https://developer.apple.com/machine-learning/models/ | |
// 2. CoreMLHelpers - https://github.com/hollance/CoreMLHelpers | |
enum RemoveBackroundResult { | |
case background | |
case finalImage | |
} | |
extension UIImage { |