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
| /* | |
| Example.m | |
| Created by Remy "Psy" Demarest on 21/04/2012. | |
| Copyright (c) 2012. Remy "Psy" Demarest | |
| Permission is hereby granted, free of charge, to any person obtaining a copy | |
| of this software and associated documentation files (the "Software"), to deal | |
| in the Software without restriction, including without limitation the rights | |
| to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
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
| @class MyClass; | |
| int main(int argc, char *argv[]) | |
| { | |
| void *obj = nil; | |
| if(obj) {} | |
| if((obj)) {} | |
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/Foundation.h> | |
| @protocol MyProtocol <NSObject> | |
| @optional | |
| - (void)myMethod; | |
| @end | |
| @interface MyClass : NSObject |
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 MyClass : NSObject | |
| + (MyClass *)sharedInstance; | |
| @end | |
| @implementation MyClass | |
| + (MyClass *)sharedInstance; | |
| { | |
| static MyClass *sharedInstance = nil; | |
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
| @implementation UIViewController (ViewControllerContainmentRetroCompatibility) | |
| static void _UIViewController_hack_removeFromParentViewController(UIViewController *self, SEL _cmd); | |
| { | |
| UIViewController *parent = [self parentViewController]; | |
| id childControllers = [parent valueForKey:@"_childViewControllers"]; | |
| [childControllers removeObject:self]; | |
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
| - (NSArray *)TS_addRotationFrameViews; | |
| { | |
| UIView *baseView = containerView; | |
| CGRect bounds = [baseView bounds]; | |
| CGFloat halfWidth = ceilf(CGRectGetWidth(bounds) / 2.0f); | |
| CGFloat halfHeight = ceilf(CGRectGetHeight(bounds) / 2.0f); | |
| UIView *topView = [[UIView alloc] initWithFrame:CGRectMake(CGRectGetMinX(bounds), | |
| CGRectGetMinY(bounds) - halfHeight, | |
| CGRectGetWidth(bounds), |
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
| #define COUNT 1000000 | |
| void incrementString(char *str) | |
| { | |
| while(*str != 0) | |
| { | |
| (*str)++; | |
| if(*str < 0x7F) break; | |
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 MyMultipleton : NSObject | |
| + (MyMultipleton *)sharedInstance; | |
| @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
| @implementation SomeClass | |
| { | |
| int ivar; | |
| } | |
| - (void)method | |
| { | |
| if(booleanValue && obj != nil) | |
| { | |
| do |
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
| - class Array | |
| { | |
| - (void)enumerateObjectsUsingBlock:((void) enumerateObject:(id)obj atIndex:(UInteger)idx shouldStop:(Boolean out)stop)block | |
| { | |
| - Boolean stop := NO. | |
| for(UInteger i := 0, count := self count ; i < count; i := + 1) | |
| { | |
| block enumerateObject: (self objectAtIndex: i) atIndex: i shouldStop: stop. | |
| if(stop) break. |