Skip to content

Instantly share code, notes, and snippets.

View magicmon's full-sized avatar

Taewoo Kang magicmon

View GitHub Profile
@pilgwon
pilgwon / TCA_README_KR.md
Last active June 19, 2024 08:24
TCA README in Korean

The Composable Architecture

The Composable Architecture(TCA)는 일관되고 이해할 수 있는 방식으로 어플리케이션을 만들기 위해 탄생한 라이브러리입니다. 합성(Composition), 테스팅(Testing) 그리고 인체 공학(Ergonomics)을 염두에 둔 TCA는 SwiftUI, UIKit을 지원하며 모든 애플 플랫폼(iOS, macOS, tvOS, watchOS)에서 사용 가능합니다.

@AshvinGudaliya
AshvinGudaliya / AGAudioRecorder.swift
Last active June 2, 2023 08:21
Simple Audio recorder and player in swift 4
//
// AGAudioRecorder.swift
// BaseProject
//
// Created by AshvinGudaliya on 17/09/18.
// Copyright © 2018 AshvinGudaliya. All rights reserved.
//
import UIKit
import AVFoundation
@tucan9389
tucan9389 / gif_convertor.sh
Last active February 18, 2020 08:07
This script converts video to gif by using ffmpeg
# Usage:
# command
# `sh gifconverter.sh /Users/canapio/Desktop/turtle_DEMO_004_4.MP4`
# on mac
# some configuration
width="240"
fps="12"
# path setup
@nyg
nyg / MemoryAddress.swift
Last active June 17, 2024 05:21
Get the memory address of both class and structure instances in Swift.
// https://stackoverflow.com/a/45777692/5536516
import Foundation
struct MemoryAddress<T>: CustomStringConvertible {
let intValue: Int
var description: String {
let length = 2 + 2 * MemoryLayout<UnsafeRawPointer>.size
@einsteinx2
einsteinx2 / locking.swift
Last active March 2, 2019 17:25 — forked from kristopherjohnson/locking.swift
Simple synchronization functions for Swift, wrapping the Cocoa NSLocking classes
import Foundation
/// Protocol for NSLocking objects that also provide try()
public protocol TryLockable: NSLocking {
func `try`() -> Bool
}
// These Cocoa classes have tryLock()
extension NSLock: TryLockable {}
extension NSRecursiveLock: TryLockable {}
/** A pthread-based recursive mutex lock. */
public class Mutex {
private var mutex: pthread_mutex_t = pthread_mutex_t()
public init() {
var attr: pthread_mutexattr_t = pthread_mutexattr_t()
pthread_mutexattr_init(&attr)
pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE)
let err = pthread_mutex_init(&self.mutex, &attr)
@ihoneymon
ihoneymon / how-to-write-by-markdown.md
Last active June 24, 2024 15:54
마크다운(Markdown) 사용법

[공통] 마크다운 markdown 작성법

영어지만, 조금 더 상세하게 마크다운 사용법을 안내하고 있는
"Markdown Guide (https://www.markdownguide.org/)" 를 보시는 것을 추천합니다. ^^

아, 그리고 마크다운만으로 표현이 부족하다고 느끼신다면, HTML 태그를 활용하시는 것도 좋습니다.

1. 마크다운에 관하여

class Mutex {
private let _mutex = UnsafeMutablePointer<pthread_mutex_t>.alloc(1)
init() {
pthread_mutex_init(_mutex, nil)
}
func lock() -> Int32 {
return pthread_mutex_lock(_mutex)
}