I hereby claim:
- I am ole on github.
- I am olebegemann (https://keybase.io/olebegemann) on keybase.
- I have a public key whose fingerprint is 8110 7FC7 27F7 56F5 3693 BA7A 90C7 D328 64A1 CEDF
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
| //: Playground - noun: a place where people can play | |
| import Cocoa | |
| protocol Feed : Equatable { | |
| var url: String {get} | |
| } | |
| protocol Folder { | |
| // This is new: |
| // | |
| // NSArray+BinarySearch.h | |
| // BinarySearch | |
| // | |
| // Created by Ole Begemann on 19.04.10. | |
| // Copyright 2010 Ole Begemann. All rights reserved. | |
| // | |
| #import <Foundation/Foundation.h> |
| /* | |
| * Generated by class-dump 3.3.4 (64 bit). | |
| * | |
| * class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2011 by Steve Nygard. | |
| */ | |
| #pragma mark Named Structures | |
| struct CGPoint { | |
| float _field1; |
| #import <Foundation/Foundation.h> | |
| typedef id(^BankAccount)(char *cmd); | |
| typedef id(^CurrentBalanceMethod)(void); | |
| typedef id(^DepositMethod)(double); | |
| typedef id(^WithdrawMethod)(double); | |
| BankAccount CreateBankAccount(double initialBalance) | |
| { | |
| // Initialization |
| <query type="relation" into="hr"> | |
| <has-kv k="route" v="bicycle"/> | |
| <bbox-query {{bbox}}/> | |
| </query> | |
| <query type="way" into="hrp"> | |
| <recurse from="hr" type="relation-way"/> | |
| <bbox-query {{bbox}}/> | |
| </query> | |
| <union> | |
| <item set="hr"/> |
| // Save this to stack.swift, then run | |
| // | |
| // $ xcrun swift stack.swift | |
| // | |
| // Does it compile or does the compiler segfault? | |
| struct Stack<Element> { | |
| var elements: [Element] = [] | |
| } |
| // Adopted from: http://stackoverflow.com/a/19976535/116862 by http://stackoverflow.com/users/2547229/benjohn. | |
| import PlaygroundSupport | |
| import UIKit | |
| let baseFont = UIFont.preferredFont(forTextStyle: .body) | |
| let baseDescriptor = baseFont.fontDescriptor | |
| let proportionalFeatures = [ | |
| [ |
| // macOS 10.12.1 or iOS 10, Swift 3.0.1 | |
| import Foundation | |
| var calendar = Calendar(identifier: .gregorian) | |
| // GMT+1 (GMT+2 under daylight saving) | |
| calendar.timeZone = TimeZone(identifier: "Europe/Berlin")! | |
| // 2016-10-30 02:30:00 +02:00 | |
| // Europe/Berlin switched from daylight saving to winter time on this date, i.e. on 2016-10-30 03:00:00 +02:00 the clock was moved back by one hour. |
| /// An array that keeps its elements sorted at all times. | |
| public struct SortedArray<Element> { | |
| // Not sure if it's a good idea to use `ArraySlice` as the backing store. It lets me make SortedArray.SubSequence == SortedArray, but the price you pay for that is that one small slice, if stored permanently and not just locally inside a function, can easily retain a much larger collection, and this is hard to notice by the developer. | |
| fileprivate var _elements: ArraySlice<Element> | |
| public typealias Comparator<A> = (A, A) -> Bool | |
| /// The predicate that determines the array's sort order. | |
| fileprivate let areInIncreasingOrder: Comparator<Element> |