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
// https://gist.github.com/feinstruktur/2f427934e171a8ab13af | |
import Foundation | |
public class Box<T> { | |
let unbox: T | |
init(_ value: T) { self.unbox = value } | |
} |
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
#!/bin/bash | |
git status | |
version=$(git describe --tags --dirty) | |
# version can be empty when there are no tags, use rev-parse in that case | |
# to log the last commit id | |
if [[ -z "$version" ]]; then | |
diff=$(git diff) | |
version=$(git rev-parse --short HEAD) |
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
- (id)init { | |
self = [super init]; | |
if (self) { | |
valuesSerialQueue = dispatch_queue_create("de.abstracture.valuesSerialQueue", NULL); | |
self.values = [NSMutableDictionary dictionary]; | |
[[NSArray arrayWithObjects: | |
@"A", @"B", @"C", @"D", @"E", @"F", nil] | |
enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) { | |
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ |
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
- (NSString *)valueForKey:(NSString *)key { | |
__block NSString *result = nil; | |
do { | |
// keep polling until there's a value | |
dispatch_sync(valuesSerialQueue, ^{ | |
result = [self.values objectForKey:key]; | |
}); | |
} while (result == nil); | |
return result; | |
} |
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
// | |
// SenTestCase+Async.h | |
// | |
// Created by Sven A. Schmidt on 2012-08-06. | |
// | |
#import <SenTestingKit/SenTestingKit.h> | |
@interface SenTestCase (Async) |
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 final class SmartPointer<T> { | |
public let pointer: UnsafeMutablePointer<T> | |
private let destructor: (UnsafeMutablePointer<T>) -> Void | |
public init(pointer: UnsafeMutablePointer<T>, destructor: (UnsafeMutablePointer<T>) -> Void) { | |
self.pointer = pointer | |
self.destructor = destructor | |
} | |
deinit { |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 source file is part of the Swift.org open source project | |
Copyright 2015 - 2016 Apple Inc. and the Swift project authors | |
Licensed under Apache License v2.0 with Runtime Library Exception | |
See http://swift.org/LICENSE.txt for license information | |
See http://swift.org/CONTRIBUTORS.txt for Swift project authors | |
*/ |
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
#!/bin/sh | |
./update_linux_tests.sh &>/dev/null | |
if [[ -n $(git diff) ]]; then | |
echo "Linux tests were out of date." | |
echo "Files have been updated, please review add them to the commit." | |
exit 1 | |
fi |
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
// Add a marker protocol to allow for new TestCase subclasses to be | |
// picked up automatically by adopting it. | |
protocol LinuxTesting {} | |
// Extend XCTestCase to conform | |
extension XCTestCase: LinuxTesting {} |
OlderNewer