Skip to content

Instantly share code, notes, and snippets.

View yoching's full-sized avatar
👋

Yoshikuni Kato yoching

👋
View GitHub Profile
@yoching
yoching / Task.swift
Created April 19, 2018 05:48
Simple Task implementation in swift
typealias Completion<Value, Error: Swift.Error> = (Result<Value, Error>) -> Void
typealias TaskHandler<Value, Error: Swift.Error> = (@escaping Completion<Value, Error>) -> Void
struct Task<Value, Error: Swift.Error> {
private let handler: TaskHandler<Value, Error>
init(_ handler: @escaping TaskHandler<Value, Error>) {
self.handler = handler
}
@yoching
yoching / setup.md
Last active July 19, 2018 03:46
Mac setup log

Things to install

  • Chrome
  • Xcode
  • SourceTree
  • Atom
  • Iterm2 & Prezi
    • need to configure .zpreztorc to enable git integration
  • BetterTouchTool
  • Deckset
  • Slack
@yoching
yoching / FunctionalViewStyle.swift
Last active April 9, 2023 19:54
Functional view style sample
import UIKit
import PlaygroundSupport
// 1. define style as function
typealias ViewStyle = (UIView) -> UIView
let cornerRadius10: ViewStyle = { view -> UIView in
view.layer.cornerRadius = 10.0
return view
}
import UIKit
import PlaygroundSupport
// 1. define style as function
// 2. make syntax readable
@yoching
yoching / FunctionalViewStyle2.swift
Last active June 5, 2020 04:28
Functional View Styling using `callAsFunction`
import UIKit
struct Style<View: UIView> {
let apply: (View) -> View
// from swift 5.2
func callAsFunction(_ view: View) -> View {
apply(view)
}
}
@yoching
yoching / PairProgrammingIntroduction.md
Last active December 6, 2021 19:26
Pair-Programming Introduction

Pair-Programming Introduction

Yoshikuni Kato


What is Pair-Programming?

  • Two people do programming together
  • Originated from Extreme Programming, which is one origin of Agile method

@yoching
yoching / Functor_Monad.swift
Created March 28, 2025 10:49
Basic of functor and monad in Swift
let array: Array<Int> = [1, 2, 3]
func double(input: Int) -> Int {
return input * 2
}
let mappedArray = array.map { value in
return double(input: value)
}