This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Swift version: Swift version 4.2-dev (LLVM c41d146806, Clang 3ef62dacf4, Swift 57940b7c68) | |
Target: x86_64-unknown-linux-gnu | |
swift: /home/buildnode/jenkins/workspace/oss-swift-4.2-package-linux-ubuntu-16_04/swift/lib/SILGen/ManagedValue.cpp:113: void swift::Lowering::ManagedValue::forwardInto(swift::Lowering::SILGenFunction &, swift::SILLocation, swift::SILValue): Assertion `isPlusOne(SGF)' failed. | |
/usr/bin/swift[0x40fc344] | |
/usr/bin/swift[0x40fa1d2] | |
/usr/bin/swift[0x40fc4f2] | |
/lib/x86_64-linux-gnu/libpthread.so.0(+0x11390)[0x7fcccbb0f390] | |
/lib/x86_64-linux-gnu/libc.so.6(gsignal+0x38)[0x7fccca24e428] | |
/lib/x86_64-linux-gnu/libc.so.6(abort+0x16a)[0x7fccca25002a] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public protocol QueryStringConvertible { | |
var asQueryString: String { get } | |
} | |
extension Array: QueryStringConvertible where Element: QueryStringConvertible { | |
public var asQueryString: String { | |
return self.reduce("") { $0.isEmpty ? $1.asQueryString : "\($0)&\($1.asQueryString)" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func serialize(object: Any) -> [String : Any]? { | |
let mirror = Mirror(reflecting: object) | |
guard mirror.displayStyle == .struct || mirror.displayStyle == .class else { | |
return .none | |
} | |
var result: [String : Any] = [:] | |
for case let (label?, value) in mirror.children { | |
let childMirror = Mirror(reflecting: value) | |
if let displayStyle = childMirror.displayStyle { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
import Darwin | |
if CommandLine.argc < 2 { | |
print("input file missing") | |
exit(1) | |
} | |
if CommandLine.argc < 3 { | |
print("column name missing") | |
exit(1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This compiles | |
let refreshState: RefreshState<String> = .searching | |
let refreshProperties: RefreshProperties<String> = properties(state: refreshState) { | |
print("") | |
$0.title = NSAttributedString(string: "Collection refresh") | |
} | |
print(refreshProperties) | |
// This compiles | |
let refreshState: RefreshState<String> = .searching |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let foo = ZipList(left: [1, 2, 3], center: 4, right: [5, 6, 7]) | |
// This is what I would like to have, a custom type conversion / casting | |
// ([Element], Element, [Element]) => ZipList<Element> | |
let bar: ZipList<Int> = ([1, 2, 3], 4, [5, 6, 7]) | |
// ZipList type definition | |
public struct ZipList<Element>: Collection, CustomDebugStringConvertible { | |
public var startIndex: Int { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
event_bus.calendar.new_event do |event| | |
# Schedule a task to be executed once the calendar event | |
# has finished | |
schedule_task(on: event.end_date) do |date| | |
# Utility function that gets a Logger::Activity | |
# object from the calendar event. It tries to | |
# infer it based on the metada of the event | |
activity = logger.activity(for: event) | |
event.participants.each do |participant| | |
slack_user = find_slack_user(email: participant.email) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct Identifier<ObjectType>: RawRepresentable, Hashable, Equatable { | |
let rawValue: String | |
init(rawValue: String) { | |
self.rawValue = rawValue | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public protocol Route: Equatable { | |
var previous: Self? { get } | |
} | |
internal enum InternalAction<RouteType: Route, MessageType> { | |
case navigateToPreviousRouteAfterPop | |
case action(Action<RouteType, MessageType>) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension Sequence { | |
func filter<A, B>(_ isIncluded: (A, B) -> Bool) -> Self { | |
return self.filter { isIncluded($0.0, $0.1) } | |
} | |
func filter<A, B, C>(_ isIncluded: (A, B, C) -> Bool) -> Self { | |
return self.filter { isIncluded($0.0, $0.1, $0.2) } | |
} | |