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
// | |
// PerfTester.h | |
// TollFreeBridingTests | |
// | |
// Created by Stuart Carnie on 1/24/10. | |
// Copyright 2010 Manomio. All rights reserved. | |
// | |
#import <Foundation/Foundation.h> |
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
#!/bin/bash | |
usage(){ | |
cat << EOF | |
usage: $0 options | |
This script create links for PLBlocks, which is useful | |
if you are installing the beta SDK into a separate folder. | |
OPTIONS: |
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 NSArray(BlocksAdditions) | |
- (NSArray*)mapUsingBlock:(id (^)(id obj))block; | |
- (NSSet*)mapToSetUsingBlock:(id (^)(id obj))block; | |
- (id)firstUsingBlock:(BOOL(^)(id obj))block; | |
@end |
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
// | |
// main.m | |
// ProtectTest | |
// Demonstrates newer versions of iOS now support PROT_EXEC pages, for just-in-time compilation. | |
// | |
// Must be compiled with Thumb disabled | |
// | |
// Created by Stuart Carnie on 3/4/11. | |
// Copyright 2011 Manomio LLC. All rights reserved. | |
// |
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
// credits to Matthias Plappert | |
#import <Foundation/Foundation.h> | |
@interface NSObject (PWBlocks) | |
- (void)performBlock:(void (^)(void))block afterDelay:(NSTimeInterval)delay; | |
@end |
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 <CoreText/CoreText.h> | |
... | |
// preload | |
dispatch_queue_t queue = dispatch_queue_create("com.company.worker", NULL); | |
dispatch_async(queue, ^(void) { | |
NSMutableDictionary *attributes = [NSMutableDictionary dictionary]; | |
[attributes setObject:@"Helvetica" forKey:(id)kCTFontFamilyNameAttribute]; | |
[attributes setObject:[NSNumber numberWithFloat:36.0f] forKey:(id)kCTFontSizeAttribute]; |
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
#!/bin/sh | |
read -p "Apple Id: " appleid; echo | |
stty -echo | |
read -p "Password: " passw; echo | |
stty echo | |
while [ /bin/true ]; do | |
curl -u$APPLEID:$PASSW developer.apple.com/devcenter/ios/index.action | grep "soon" | |
if [ $? -eq 1 ]; then | |
growlnotify -m "Done" |
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 RetrieveFriends(GameCenter& gameCenter, GKLocalPlayer* localPlayer) | |
{ | |
[localPlayer loadFriendsWithCompletionHandler:^(NSArray* friends, NSError* error) | |
{ | |
[GKPlayer loadPlayersForIdentifiers:friends withCompletionHandler:^(NSArray* players, NSError* error2) | |
{ | |
dispatch_async(dispatch_get_main_queue(), ^(void) | |
{ | |
TestLala(gameCenter); //, friends, players, error2); | |
}); |
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 RetrieveFriends(GameCenter& gameCenter, GKLocalPlayer* localPlayer) | |
{ | |
[localPlayer loadFriendsWithCompletionHandler:^(NSArray* friends, NSError* error) | |
{ | |
// 1. this block is copied and retained by loadFriendsWithCompletionHandler | |
// 2. When called, loadPlayersForIdentifiers:withCompletionHandler will copy and retain the block below, | |
// which doesn't exist until the outer block is called | |
[GKPlayer loadPlayersForIdentifiers:friends withCompletionHandler:^(NSArray* players, NSError* error2) | |
{ | |
// Finally, dispatch_async will copy and retain the block which is passed to it below |
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
#include <objc/runtime.h> | |
// this is called when a keyboard is attached / detached, and | |
// isHardwareAttached will return YES / NO appropriately | |
void hardwareChangeIMP(id aSelf, SEL sel, BOOL isHardwareAttached) { | |
SEL newSel = NSSelectorFromString(@"_modeChange:"); | |
[aSelf performSelector:newSel withObject:[NSNumber numberWithBool:isHardwareAttached]]; | |
} | |
// call this to start capturing hardware changes |
OlderNewer