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
// | |
// NSObject+BlockObservation.h | |
// Version 1.0 | |
// | |
// Andy Matuschak | |
// andy@andymatuschak.org | |
// Public domain because I love you. Let me know how you use it. | |
// | |
#import <Cocoa/Cocoa.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
// | |
// CCBlockTableViewDataSource.h | |
// | |
// Created by Tristan O'Tierney on 1/24/11. | |
// | |
#import <UIKit/UIKit.h> | |
@interface CCBlockTableViewDataSource : NSObject <UITableViewDataSource, UITableViewDelegate> { |
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
static NSInteger STEarthRadiusKilometers = 6371; | |
- (NSNumber *)distanceFromLatitude:(NSDecimalNumber *)inLatitude longitude:(NSDecimalNumber *)inLongitude; | |
{ | |
CLLocationDegrees inLatitudeDegrees = [inLatitude doubleValue]; | |
CLLocationDegrees latitudeDegrees = [self.latitude doubleValue]; | |
CLLocationDegrees inLongitudeDegrees = [inLongitude doubleValue]; | |
CLLocationDegrees longitudeDegrees = [self.longitude doubleValue]; | |
double distance = acos(sin(inLatitudeDegrees) * sin(latitudeDegrees) + cos(inLatitudeDegrees) * cos(latitudeDegrees) * cos(longitudeDegrees - inLongitudeDegrees)) * STEarthRadiusKilometers; |
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
typedef void (^SGBlock)(); | |
@interface NSTimer (Blocks) | |
+ (id)scheduledTimerWithTimeInterval:(NSTimeInterval)interval repeats:(BOOL)shouldRepeat block:(SGBlock)block; | |
+ (id)timerWithTimeInterval:(NSTimeInterval)interval repeats:(BOOL)shouldRepeat block:(SGBlock)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
self.view.layer.anchorPoint = CGPointMake(0.50, 1.0); | |
CAKeyframeAnimation *bounceAnimation = [CAKeyframeAnimation animationWithKeyPath:@"transform.scale"]; | |
bounceAnimation.values = [NSArray arrayWithObjects: | |
[NSNumber numberWithFloat:0.05], | |
[NSNumber numberWithFloat:1.08], | |
[NSNumber numberWithFloat:0.92], | |
[NSNumber numberWithFloat:1.0], | |
nil]; |
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
CGFloat BNRTimeBlock (void (^block)(void)); |
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
OPTIONS = metaclass.m -o metaclass -std=c99 -framework Foundation -arch x86_64 -Os | |
isa: | |
clang -DUSE_ISA=1 $(OPTIONS) | |
./metaclass | |
object_getClass: | |
clang -DUSE_ISA=0 $(OPTIONS) | |
./metaclass |
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
/* | |
* Most NSString instances will actually be __NSCFString instances, so here are both NSString and __NSCFString implementations. | |
* If you know how to create an NSString instance whose class is actually NSString please let me know. | |
* Other possible concrete subclasses of NSString are: NSConstantString, __NSCFConstantString, NSPathStore2, NSSimpleCString and __NSLocalizedString. | |
*/ | |
// CoreFoundation.framework 635.19.0 (Mac OS X 10.7.3) | |
@implementation NSObject | |
- (BOOL) isNSString__ |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<style> | |
/* Core CSS */ | |
#box | |
{ | |
background: white; |
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> | |
#import <objc/runtime.h> | |
@interface NSNotificationCenter (AllObservers) | |
- (NSSet *) my_observersForNotificationName:(NSString *)notificationName; | |
@end |
OlderNewer