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
// % clang -framework Foundation -o ObjCSuper ObjCSuper.m SuperTrampoline.s | |
// % ./ObjCSuper | |
// | |
// 2014-02-15 23:03:32.498 ObjCSuper[1296:507] Subclass impl | |
// 2012014-02-15 23:03:32.498 ObjCSuper[1296:507] Subclass impl4-02-15 23:03:32.500 ObjCSuper[1296:507] b respondsToSelector:@selector(retain)? YES | |
// 2014-02-15 23:03:32.500 ObjCSuper[1296:507] b respondsToSelector:@selector(subclassMethod)? YES | |
// 2014-02-15 23:03:32.501 ObjCSuper[1296:507] Superclass impl | |
// 2014-02-15 23:03:32.501 ObjCSuper[1296:507] b_super respondsToSelector:@selector(retain)? YES | |
// 2014-02-15 23:03:32.501 ObjCSuper[1296:507] b_super respondsToSelector:@selector(subclassMethod)? NO |
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
@implementation JPAppDelegate | |
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification | |
{ | |
[NSApp registerServicesMenuSendTypes:[NSArray arrayWithObjects:NSStringPboardType, nil] returnTypes:[NSArray arrayWithObjects:nil]]; | |
[self updateMenu]; | |
} | |
#pragma mark - Services |
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
// | |
// Copyright (c) 2014 Cédric Luthi “0xced” | |
// | |
// ./uncruftapidiff https://developer.apple.com/library/prerelease/ios/releasenotes/General/iOS80APIDiffs/index.html iOS8_0APIDiffs.html | |
// ./uncruftapidiff https://developer.apple.com/library/prerelease/mac/documentation/General/Reference/APIDiffsMacOSX10_10SeedDiff/index.html OSX10_10APIDiffs.html | |
// | |
#import <Foundation/Foundation.h> | |
#import <sysexits.h> |
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 protocol CountableCollectionType: CollectionType { | |
var count: Int { get } | |
} | |
extension Array: CountableCollectionType {} | |
public protocol CollectionViewCellFactoryType { | |
typealias Item | |
typealias Cell: UICollectionViewCell | |
func cellForItem(item: Item, inCollectionView collectionView: UICollectionView, atIndexPath indexPath: NSIndexPath) -> Cell |
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/Foundation.h> | |
int main(int argc, const char * argv[]) { | |
@autoreleasepool { | |
void (^benchmark)(const char *str) = ^(const char *str) { | |
const long count = 10000000; | |
NSDate *start = [NSDate date]; | |
for (long i = 0; i < count; i++) { | |
(void)[[NSString alloc] initWithUTF8String:str]; | |
} |
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 | |
target_name="foo" # Remember to set your name here | |
target_email="foo@example.com" # Set the new email here | |
git filter-branch --commit-filter 'if [ "$GIT_AUTHOR_NAME" = $target_name ]; | |
then export GIT_AUTHOR_EMAIL=$target_email; | |
fi; git commit-tree "$@"' |
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
CGPoint CGPointFlipped(CGPoint point, CGRect bounds) { | |
return CGPointMake(point.x, CGRectGetMaxY(bounds)-point.y); | |
} | |
CGRect CGRectFlipped(CGRect rect, CGRect bounds) { | |
return CGRectMake(CGRectGetMinX(rect), | |
CGRectGetMaxY(bounds)-CGRectGetMaxY(rect), | |
CGRectGetWidth(rect), | |
CGRectGetHeight(rect)); | |
} |
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
- (void)testBooleanLiteralsAreOfTypeBool { | |
NSNumber *testBoolNumber = @YES; | |
const char *typeString = [testBoolNumber objCType]; | |
STAssertTrue('c' == *typeString, @"Boxed BOOL is of type %s, not of type 'c' (signed char, aka BOOL).", typeString); | |
} | |
- (void)testBoxedBooleanLiteralsAreOfTypeBool { | |
// Boxing works fine if a BOOL value is boxed directly... | |
BOOL testBool = YES; | |
NSNumber *testBoolNumber = @(testBool); |
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
// doesn't work with __block variables | |
#define keypath2(PATH) \ | |
do { \ | |
const char *_path = strchr(# PATH, '.') + 1; \ | |
\ | |
id _capturingBlock = ^{ \ | |
return PATH; \ | |
}; \ | |
\ | |
struct _literal { \ |
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
// | |
// main.swift | |
// NodeTraversal | |
// | |
// Created by Steven Hepting on 11/16/15. | |
// Copyright © 2015 Steven Hepting. All rights reserved. | |
// Algorithm from http://bit.ly/1kSdSvc | |
// | |
import Foundation |
OlderNewer