This file contains hidden or 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
unsetenv PATH | |
unsetenv GREP_COLOR | |
unsetenv MANPATH | |
unsetenv LDFLAGS | |
unsetenv TERM_PROGRAM | |
unsetenv GEM_HOME | |
unsetenv M2 | |
unsetenv TERM | |
unsetenv SHELL | |
unsetenv TMPDIR |
This file contains hidden or 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
#! /usr/bin/env python | |
import hmac | |
import sys | |
import os | |
from hashlib import md5 | |
def exit_with_usage(): | |
print """ | |
Usage: gen_no_login job_id [username] [access_key] |
This file contains hidden or 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
[] === [] //< false, see http://stackoverflow.com/questions/7837456/comparing-two-arrays-in-javascript |
This file contains hidden or 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
- (void)testCopyReturnsImmutable | |
{ | |
NSDictionary* immutable = @{@"foo": @"bar"}; | |
NSMutableDictionary* mutable = [immutable mutableCopy]; | |
NSDictionary* copyOfMutable = [mutable copy]; | |
XCTAssertFalse([copyOfMutable isMemberOfClass:[NSMutableDictionary class]]); | |
// interestingly, the class is actually __NSDictionaryI, so you can't assert isMemberOfClass:NSDictionary | |
XCTAssertTrue([copyOfMutable isKindOfClass:[NSDictionary class]]); | |
} |
This file contains hidden or 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 demonstrates a critical, yet absent compiler warning for the missing return in this non-void function. | |
- (id)nonVoidFunctionWithoutReturn { | |
@try { | |
[NSException raise:@"foo" format:nil]; | |
} @catch (NSException* e) { | |
NSLog([e description]); | |
} | |
/* | |
@finally { | |
// adding @finally doesn't make a difference |
This file contains hidden or 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-04-12 18:01:37.224 xctest[36363:1321742] *** Assertion failure in -[HomeFriesTests.AppleHashSpec measureMetrics:automaticallyStartMeasuring:forBlock:], /SourceCache/XCTest_Sim/XCTest-7503/XCTestFramework/Classes/XCTestCase.m:1022 | |
<unknown>:0: error: -[HomeFriesTests.AppleHashSpec a_hashable_person__should_have_a_performant_hash_function] : failed: caught "NSInternalInconsistencyException", "-numberOfTestIterationsForTestWithSelector: returned 0 for -[HomeFriesTests.AppleHashSpec (null)]. -numberOfTestIterationsForTestWithSelector: must return 1 for tests that call -measure...Block: APIs." | |
( | |
0 CoreFoundation 0x000000010c124c65 __exceptionPreprocess + 165 | |
1 libobjc.A.dylib 0x000000010bdbdbb7 objc_exception_throw + 45 | |
2 CoreFoundation 0x000000010c124aca +[NSException raise:format:arguments:] + 106 | |
3 Foundation 0x000000010b9d298f -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + |
This file contains hidden or 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 qualified Data.Text as Text | |
import qualified Data.Text.IO | |
import qualified Data.Map as Map | |
import Data.List | |
import Data.Ord | |
-- Restrict histogram values to Int (shouldn't be too big and removes default constraint warnings) | |
type TextHistogramValue = Int | |
type TextHistogramKey = Text.Text | |
type TextHistogramEntry = (TextHistogramKey, TextHistogramValue) |
This file contains hidden or 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
#! /usr/bin/env bash | |
set -e | |
declare -r OUTPUT_DIR="$1" | |
shift | |
if [[ "$OUTPUT_DIR" == "" ]]; then | |
echo "Need to specify an output directory as the first argument" |
This file contains hidden or 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
@interface WMFRetainCycleTests : XCTestCase | |
@property (strong, nonatomic) void(^block)(id); | |
@end | |
@implementation WMFRetainCycleTests | |
- (void)testUsingArgument { | |
WMFRetainCycleTests* noCycle = [WMFRetainCycleTests new]; | |
__weak WMFRetainCycleTests* weakRef = noCycle; | |
noCycle.block = ^ (id y) { |
This file contains hidden or 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 | |
public protocol UniversalResourceType { | |
var locator: NSURL { get } | |
} | |
public protocol HTTPResponseType : UniversalResourceType, Printable { } | |
public class HTTPResponse<T: Printable> : UniversalResourceType, Printable { | |
public var response: T |