Skip to content

Instantly share code, notes, and snippets.

Avatar

Alex Reilly twof

View GitHub Profile
View Binding+Collection.swift
extension Binding: Sequence where Value == Array<Track> {
public typealias Iterator = IndexingIterator<Array<Binding<Track>>>
public __consuming func makeIterator() -> IndexingIterator<Array<Binding<Track>>> {
return IndexingIterator(_elements: (0..<wrappedValue.count).map { projectedValue[$0] })
}
}
extension Binding: Collection where Value == Array<Track> {
public typealias Element = Binding<Track>
View Binding+boundItems.swift
extension Binding where Value == Array<Track> {
var boundItems: Array<Binding<Track>> {
return (0..<wrappedValue.count).map { projectedValue[$0] }
}
}
View Test.js
console.log("hello world")
// This is a comment to add more lines
// Another line to demonstrate an edit
View lldblog.swift
(lldb) call UnsafeMutablePointer<[HTTPCookie]>.allocate(capacity: 1)
(UnsafeMutablePointer<[HTTPCookie]>) $R0 = 0x00007f7f89c16380
(lldb) call cookieStore.getAllCookies { cs in $R0.initialize(to: cs); print("Done") }
(lldb) call RunLoop.main.run(mode: .common, before: Date())
(Bool) $R4 = false
(lldb) call RunLoop.main.run(mode: .common, before: Date())
(Bool) $R6 = false
(lldb) call RunLoop.main.run(mode: .common, before: Date())
(Bool) $R8 = false
(lldb) call RunLoop.main.run(mode: .common, before: Date())
View BrokenTests.swift
final class CrudRouteGetResponseTests: XCTestCase {
var app: Application!
override func setUp() {
super.setUp()
app = Application()
try! configure(app)
try! app.migrator.setupIfNeeded().wait()
View gist:5501a4c16659f9eacf5e05fc372a9d39
$ swift build
Updating https://github.com/apple/swift-nio-extras.git
Updating https://github.com/vapor/open-crypto.git
Updating https://github.com/vapor/async-kit.git
Updating https://github.com/vapor/console-kit.git
Updating https://github.com/vapor/fluent-kit.git
Updating https://github.com/vapor/sql-kit.git
Updating https://github.com/apple/swift-nio.git
Updating https://github.com/vapor/vapor.git
Updating https://github.com/vapor/fluent.git
View Party.swift
import SwiftUI
import Combine
struct Track: Hashable, Identifiable {
var id: Int
let name: String
var voteScore: Int = 0
var currentVote: VoteDirection = .none
View Generics.swift
protocol Node {
associatedtype Value: Numeric
func execute() -> Value
}
protocol Operator: Node {
associatedtype LeftNode: Node
associatedtype RightNode: Node
View gradient.js
class Gradient extends React.Component {
render() {
// var topColor = this.props.topColor
// var bottomColor = this.props.bottomColor
console.log(typeof this.props.children)
var child = this.props.children
// console.log(child.props.children)
while(typeof child.props.children == 'object') {
console.log(typeof child)
child = child.props.children
View circletestoutput.json
[
{
"message": "\u001b[2K\r[1/3] Compiling Swift Module 'RoutingKitTests' (1 sources)\u001b[2K\r\u001b[1m/root/project/Tests/RoutingKitTests/RouterTests.swift:256:5: \u001b[0;1;35mwarning: \u001b[0m\u001b[1mwill never be executed\r\n\u001b[0m print()\r\n\u001b[0;1;32m ^\r\n\u001b[0m\u001b[1m/root/project/Tests/RoutingKitTests/RouterTests.swift:252:11: \u001b[0;1;30mnote: \u001b[0m\u001b[1mcondition always evaluates to false\r\n\u001b[0m guard !_isDebugAssertConfiguration() else {\r\n\u001b[0;1;32m ^\r\n\u001b[0m\u001b[2K\r[2/3] Compiling Swift Module 'routing_kitPackageTests' (1 sources)\u001b[2K\r[3/3] Linking ./.build/x86_64-unknown-linux/debug/routing-kitPackageTests.xctest\r\nTest Suite 'All tests' started at 2019-02-21 02:35:30.698\r\nTest Suite 'debug.xctest' started at 2019-02-21 02:35:30.699\r\nTest Suite 'RouterTests' started at 2019-02-21 02:35:30.699\r\nTest Case 'RouterTests.testRouter' started at 2019-02-21 02:35:30.699\r\nTest Case 'RouterTests.testRouter' passed (0
You can’t perform that action at this time.