Skip to content

Instantly share code, notes, and snippets.

protocol A {
func foo()
}
extension A {
default func foo() { … } // Dynamically dispatched b/c it’s in the protocol
func bar() { … } // Statically dispatched b/c it’s not in the protocol
}
// Dynamic shadows static
public protocol P {
func foo()
}
public protocol Q: P {
}
extension Q {
final func foo() { … }
}
project_cache/Chatto/Chatto/Source/ChatController/BaseChatViewController+Changes.swift: case .preservePosition(rectForReferenceIndexPathBeforeUpdate: let oldRect, referenceIndexPathAfterUpdate: let indexPath):
project_cache/Chatto/ChattoAdditions/Source/Chat Items/TextMessages/Views/TextMessageCollectionViewCellDefaultStyle.swift: case let .template(isIncoming: isIncoming, showsTail: showsTail):
project_cache/Chatto/ChattoAdditions/Source/Chat Items/TextMessages/Views/TextMessageCollectionViewCellDefaultStyle.swift: case let .normal(isIncoming: isIncoming, status: status, showsTail: showsTail, isSelected: isSelected):
project_cache/GRDB.swift/GRDB/Core/Database.swift: case .transaction(action: let action):
project_cache/GRDB.swift/GRDB/Core/Database.swift: case .savepoint(name: let name, action: let action):
project_cache/GRDB.swift/GRDB/Core/Database.swift: case .insert(tableName: let tableName): return tableName
project_cache/GRDB.swift/GRDB/Core/Dat
project_cache/Chatto/ChattoAdditions/Source/Chat Items/TextMessages/Views/TextMessageCollectionViewCellDefaultStyle.swift: case let .template(isIncoming: isIncoming, showsTail: showsTail):
project_cache/Chatto/ChattoAdditions/Source/Chat Items/TextMessages/Views/TextMessageCollectionViewCellDefaultStyle.swift: case let .normal(isIncoming: isIncoming, status: status, showsTail: showsTail, isSelected: isSelected):
project_cache/Lark/Sources/CodeGenerator/Generator.swift: case let .list(itemType: itemType): hierarchy.insertEdge((.type(type.name!), .type(itemType)))
project_cache/Lark/Sources/CodeGenerator/WebServiceDescription+verify.swift: case let .list(itemType: itemType): return [Edge(from: from, to: .type(itemType))]
project_cache/ProcedureKit/Sources/ProcedureKit/Repeat.swift: case let .random(minimum: min, maximum: max):
project_cache/ProcedureKit/Sources/ProcedureKit/Repeat.swift: case let .incrementing(initial: initial, increment: increment):
project_cac

What are the Rules for dating in the work place? Flirting?

What are the clear red lines?

Where does the line between work life and social life stop and start?

What mindset causes dating and flirting to be the first thing to come to mind when many men think about women in the workplace?

What can man do to professionalize their perception of women, and keep sexual obsession out of their work relationships?

// Siesta’s Resource class represents the current “best information available”
// about a RESTful resource. Other parts of the code can observe changes to
// that state (started loading, received new data, received error, etc):
public protocol ResourceObserver
{
func resourceChanged(_ resource: Resource, event: ResourceEvent)
// (plus other stuff I’m ignoring)
}
@pcantrell
pcantrell / assuming.md
Last active July 10, 2018 05:47
assuming

Goals

  • Create a standard way for devs to document what assumption led them to use an unsafe operation (e.g. force unwrap).
  • Cover all trapping operations (!, try!, as!, []) through a single mechanism. (Lack of this seems to have been Lattner’s primary beef with the previous proposal.)
  • Make this mechanism work as both:
    • developer documentation — clear, readable, and not excessively noisy in the code itself — and
    • runtime diagnostic, included in console / crash logs to expedite debugging.

Solution

import Foundation
// WHY HAVE A TIMER SYNCED TO DISPLAY REFRESH?
//
// Sparked by this question from Nick Lockwood:
// https://twitter.com/nicklockwood/status/1131650052701786114
class TimerPhasingSimulation
{
// –––––– Heart of the simulation ––––––