Skip to content

Instantly share code, notes, and snippets.

View ezura's full-sized avatar

Yuka Ezura ezura

View GitHub Profile
@ukitaka
ukitaka / output
Created July 14, 2018 04:47
swift -frontend -typecheck -debug-constraints test.swift
---Constraint solving for the expression at [test.swift:1:14 - line:1:14]---
---Initial constraints for the given expression---
(integer_literal_expr type='$T0' location=test.swift:1:14 range=[test.swift:1:14 - line:1:14] value=0)
Score: 0 0 0 0 0 0 0 0 0 0 0 0
Contextual Type: Int at [test.swift:1:8 - line:1:8]
Type Variables:
$T0 [inout allowed] literal=3 bindings={(subtypes of) (default from ExpressibleByIntegerLiteral) Int} @ locator@0x7faa21801000 [IntegerLiteral@test.swift:1:14]
Active Constraints:
@inamiy
inamiy / typed-error-poem.md
Last active November 8, 2018 13:58
Swift Poem: Why I prefer typed error (for https://github.com/apple/swift-evolution/pull/757)

Typed error can be useful in certain cases, especially when accompanied with NoError type.

For example, in reactive programming, https://github.com/ReactiveCocoa/ReactiveSwift (typed error) allows us to create UI bindings only if Error is NoError, i.e.:

static func <~ <Source: BindingSource> (provider: Self, source: Source) -> Disposable? 
    where Source.Value == Value, Source.Error == NoError { ... }
    
// example
let alphaSignal: Signal = ...
@KentarouKanno
KentarouKanno / Array Basic.md
Last active June 30, 2018 10:42
Array Basic

Array Basic

Array Custom

★ 初期化

// Int型の配列(初期化いろいろ)
var intArray: Array<Int> = Array<Int>.init([])
var intArray: Array<Int> = Array<Int>()
var intArray: Array<Int> = [Int].init([])f
@calebd
calebd / AsynchronousOperation.swift
Last active April 29, 2023 13:12
Concurrent NSOperation in Swift
import Foundation
/// An abstract class that makes building simple asynchronous operations easy.
/// Subclasses must implement `execute()` to perform any work and call
/// `finish()` when they are done. All `NSOperation` work will be handled
/// automatically.
open class AsynchronousOperation: Operation {
// MARK: - Properties
@shinyaohira
shinyaohira / Auto Layout Guide.md
Last active November 23, 2019 14:50
Auto Layout Guide
@shinyaohira
shinyaohira / View Controller Programming Guide for iOS.md
Last active July 19, 2023 13:23
iOS View Controllerプログラミングガイド

storyboard上で、initial view controllerから他のview controllerに対してrelationshipを確立します。同様に、それらのview controllerから他のview controllerにrelationshipを確立します。最終的に、storyboard上のほとんど、あるいは全てのview controllerを一つのグラフに接続します。接続されたview controllerが、iOSによっていつインスタンス化されるかは、relationshipのタイプによって決まります。

@PGMY
PGMY / gist:3434749
Created August 23, 2012 09:39 — forked from rosylilly/gist:3401612
先輩と覚える HTTP ステータスコード

先輩に学ぶ HTTP Status Code

超雑にまとめました。修正してください。

登場人物

  • アプリケーション先輩: いつも忙しい。横に広がるのが得意(デブじゃない)。
  • 後輩: 頼んでばっかしで役に立たない。
  • サーバー先輩: アプリケーション先輩と仲がいい。Unix Socket でつながるくらい仲良し。
  • プロクシ先輩: アプリケーション先輩とかサーバー先輩と後輩の間を取り持って代わりに伝えたりしてくれる。たまに勝手にレスポンスを書き換える。