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
module ExhaustiveEnum | |
def self.included(base) | |
base.extend(ClassMethods) | |
end | |
module ClassMethods | |
def switch(value, &block) | |
matcher = ExhaustiveMatcher.new(self) | |
matcher.match(value, &block) | |
end |
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
Gen(unGen: { r, n in | |
let splitGen: () -> StdGen = { | |
var g: StdGen = r.split.0 | |
return { | |
g = g.split.0 | |
return g | |
} | |
}() | |
let Foo = Foo() |
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
// a bunch of requires & tiny helper fns... | |
function directoriesAtPath(path) { | |
return fs.readdir(dir) | |
.then(fp.map(appendToParentDir)) | |
.then(zipPathsWithStats) | |
.then(mapWithoutNil(pathIfTupleIsDirectory)); | |
}; |
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 CoreLocation | |
let l = CLLocation(latitude: 0, longitude: 0) | |
let data = NSKeyedArchiver.archivedDataWithRootObject(l) | |
let lprime = NSKeyedUnarchiver.unarchiveObjectWithData(data) as! CLLocation | |
l == lprime | |
// $R0: Bool = false | |
l.description | |
// $R2: String = "<+0.00000000,+0.00000000> +/- 0.00m (speed -1.00 mps / course -1.00) @ 2/29/16, 12:34:25 PM Eastern Standard Time" | |
lprime.description |
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
App Thinning Size Report for All Variants of Wikipedia | |
Variant: Wikipedia-iPhone 6.ipa | |
Supported devices: iPhone 6 | |
App + On Demand Resources size: 7 MB compressed, 18.1 MB uncompressed | |
App size: 7 MB compressed, 18.1 MB uncompressed | |
On Demand Resources size: Zero KB compressed, Zero KB uncompressed |
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 testSDWebImageDownloaderOperationThreadSafety() { | |
NSURLProtocol.registerClass(WMFHTTPHangingProtocol) | |
defer { | |
NSURLProtocol.unregisterClass(WMFHTTPHangingProtocol) | |
} | |
[0...1000].forEach { _ in | |
let downloadOperation = SDWebImageDownloaderOperation( | |
request: NSURLRequest(URL: NSURL(string: "https://test.org/foo")!), | |
options: [], |
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
- (int)exampleA { | |
if (foo) { | |
return 1; | |
} | |
// no man's land for side effects | |
if (bar) { | |
return 2; | |
} |
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 UIKit | |
public protocol CellContainer { | |
var visibleCells: [NSIndexPath] { get } | |
} | |
public protocol CollectionViewContainer { | |
var collectionView: UICollectionView? { get } | |
} |
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
2015-10-13 18:20:28.865 Wikipedia Debug[976:36527763] *** Assertion failure in -[UICollectionView _endItemAnimationsWithInvalidationContext:tentativelyForReordering:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit_Sim/UIKit-3505.16/UICollectionView.m:3936 | |
2015-10-13 18:20:28.879 Wikipedia Debug[976:36527763] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'attempt to delete and reload the same index path (<NSIndexPath: 0xc000000000000016> {length = 2, path = 0 - 0})' | |
*** First throw call stack: | |
( | |
0 CoreFoundation 0x000000010b694f65 __exceptionPreprocess + 165 | |
1 libobjc.A.dylib 0x000000010b10edeb objc_exception_throw + 48 | |
2 CoreFoundation 0x000000010b694dca +[NSException raise:format:arguments:] + 106 | |
3 Foundation 0x0000000108851ae2 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 198 | |
4 UIKit 0x0000 |
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
# Generic | |
Pods/.* | |
Applications/Xcode.app/.* | |
vendor/.* | |
Carthage/.* | |
build/.* | |
.*Tests.m | |
.*Tests.swift | |
# Wikipedia-specific test folders | |
# We filter the entire folder to exclude coverage of test utility code |
NewerOlder