Skip to content

Instantly share code, notes, and snippets.

View gaeng2y's full-sized avatar
๐Ÿฆ–
Mai Paura

Kyeongmo Yang gaeng2y

๐Ÿฆ–
Mai Paura
View GitHub Profile
@JCSooHwanCho
JCSooHwanCho / Combine+Cooldown.swift
Created September 2, 2023 13:48
Combine operator that mimics RxSwift's throttle when latest: false
extension Publisher {
func coolDown<S: Scheduler>(for cooltime: S.SchedulerTimeType.Stride,
scheduler: S) -> some Publisher<Self.Output, Self.Failure> {
return self.receive(on: scheduler)
.scan((S.SchedulerTimeType?.none, Self.Output?.none)) {
let eventTime = scheduler.now
let minimumTolerance = scheduler.minimumTolerance
guard let lastSentTime = $0.0 else {
return (eventTime, $1)
}
@sujinnaljin
sujinnaljin / DictionaryStorageMacro.swift
Created July 1, 2023 07:36
DictionaryStorageMacro.swift
public struct DictionaryStorageMacro: MemberMacro {
public static func expansion(of node: AttributeSyntax,
providingMembersOf declaration: some DeclGroupSyntax,
in context: some MacroExpansionContext
) throws -> [DeclSyntax] {
let stringIdentifier = SimpleTypeIdentifierSyntax(name: .identifier("String"))
let anyIdentifier = SimpleTypeIdentifierSyntax(name: .keyword(.Any))
let dictionarySyntax = DictionaryTypeSyntax(leftSquareBracket: .leftSquareBracketToken(),
keyType: stringIdentifier,
@pilgwon
pilgwon / TCA_README_KR.md
Last active December 15, 2025 05:39
TCA README in Korean

The Composable Architecture

The Composable Architecture(TCA)๋Š” ์ผ๊ด€๋˜๊ณ  ์ดํ•ดํ•  ์ˆ˜ ์žˆ๋Š” ๋ฐฉ์‹์œผ๋กœ ์–ดํ”Œ๋ฆฌ์ผ€์ด์…˜์„ ๋งŒ๋“ค๊ธฐ ์œ„ํ•ด ํƒ„์ƒํ•œ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ์ž…๋‹ˆ๋‹ค. ํ•ฉ์„ฑ(Composition), ํ…Œ์ŠคํŒ…(Testing) ๊ทธ๋ฆฌ๊ณ  ์ธ์ฒด ๊ณตํ•™(Ergonomics)์„ ์—ผ๋‘์— ๋‘” TCA๋Š” SwiftUI, UIKit์„ ์ง€์›ํ•˜๋ฉฐ ๋ชจ๋“  ์• ํ”Œ ํ”Œ๋žซํผ(iOS, macOS, tvOS, watchOS)์—์„œ ์‚ฌ์šฉ ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค.

@JCSooHwanCho
JCSooHwanCho / FileIO.swift
Last active August 18, 2025 11:32
psํ•  ๋•Œ ์ž…๋ ฅ์„ ํ•œ๊บผ๋ฒˆ์— ๋ฐ›๊ธฐ ์œ„ํ•œ ์œ ํ‹ธ๋ฆฌํ‹ฐ ํด๋ž˜์Šค. fread์˜ swift ๋ฒ„์ „.
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)] // ์ธ๋ฑ์Šค ๋ฒ”์œ„ ๋„˜์–ด๊ฐ€๋Š” ๊ฒƒ ๋ฐฉ์ง€
@iamchiwon
iamchiwon / pod_update.sh
Last active February 2, 2023 05:51
Xcode behavior ์šฉ: pod ์—…๋ฐ์ดํŠธ ํ•˜๊ธฐ
#!/bin/bash
# move project dir
PROJECT_HOME=`pwd`
echo "cd $PROJECT_HOME" > /tmp/tmp.sh
# pod init & update
echo "pod update" >> /tmp/tmp.sh
chmod +x /tmp/tmp.sh
@iamchiwon
iamchiwon / pod_init.sh
Last active February 2, 2023 05:51
Xcode behavior ์šฉ: pod init ํ•˜๊ธฐ
#!/bin/bash
# move project dir
PROJECT_HOME=`pwd`
echo "cd $PROJECT_HOME" > /tmp/tmp.sh
# search .xcodeproj file and strip filename
PROJECT_NAME=""
for f in *.xcodeproj; do
PROJECT_NAME="${f%.*}"
@deepakpk009
deepakpk009 / media.json
Created November 8, 2017 14:02
sample free video urls
{
"categories": [
{
"name": "Movies",
"videos": [
{
"description": "Big Buck Bunny tells the story of a giant rabbit with a heart bigger than himself. When one sunny day three rodents rudely harass him, something snaps... and the rabbit ain't no bunny anymore! In the typical cartoon tradition he prepares the nasty rodents a comical revenge.\n\nLicensed under the Creative Commons Attribution license\nhttp://www.bigbuckbunny.org",
"sources": [
"http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4"
],
@toddhopkinson
toddhopkinson / BackgroundTransferSample.swift
Last active September 27, 2023 01:47
Upload Very Large Files In Background on iOS - Alamofire.upload multipart in background
// You have a very very large video file you need to upload to a server while your app is backgrounded.
// Solve by using URLSession background functionality. I will here use Alamofire to enable multipart upload.
class Networking {
static let sharedInstance = Networking()
public var sessionManager: Alamofire.SessionManager // most of your web service clients will call through sessionManager
public var backgroundSessionManager: Alamofire.SessionManager // your web services you intend to keep running when the system backgrounds your app will use this
private init() {
self.sessionManager = Alamofire.SessionManager(configuration: URLSessionConfiguration.default)
self.backgroundSessionManager = Alamofire.SessionManager(configuration: URLSessionConfiguration.background(withIdentifier: "com.lava.app.backgroundtransfer"))