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
| #ifndef __has_feature | |
| #define __has_feature(feature) 0 | |
| #endif | |
| #define MAWeakVar(var) __weak_ ## var | |
| #if __has_feature(objc_arc_weak) | |
| #define MAWeakDeclare(var) __weak __typeof__((var)) MAWeakVar(var) = var | |
| #define MAWeakImport(var) __typeof__((MAWeakVar(var))) var = MAWeakVar(var) |
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
| id object = [[NSObject alloc] init]; | |
| dispatch_queue_t queue = dispatch_queue_create("whatever", 0); | |
| dispatch_async(queue, ^ void (void) __weak(object) { | |
| if(object != nil) | |
| { | |
| [object doNastyThings]; | |
| } | |
| }); |
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
| #ifndef NS_CONSUMES_SELF | |
| #define NS_CONSUMES_SELF __attribute__((ns_consumes_self)) | |
| #endif |
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> | |
| @interface MyClass : NSObject | |
| - (id)initWithIvar:(int)value; | |
| - (void)testInnerBlock; | |
| @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 <Foundation/Foundation.h> | |
| @interface NSString (Evil) | |
| @property(assign, setter=initWithString:) NSString *initWithString; | |
| @property(assign, readonly) NSString *test; | |
| @property(assign, readonly) NSArray *(^split)(NSString *); | |
| @end | |
| int main(int argc, char *argv[]) | |
| { |
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
| isClass = [object PSYJK_JSONClass]; | |
| if(isClass == PSYJKClassUnknown |
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 <UIKit/UIKit.h> | |
| @interface UIControl (PSYBlockTargetAddition) | |
| - (id)addTargetForControlEvents:(UIControlEvents)controlEvents usingBlock:(void(^)(id sender, UIEvent *event))block; | |
| - (void)removeTarget:(id)target forControlEvents:(UIControlEvents)controlEvents; | |
| @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
| /* | |
| * PSYLayerConstraintLayoutManager.h | |
| * LayoutManager | |
| * | |
| * Created by Remy Demarest on 27/02/2010. | |
| * Copyright (c) 2010, Remy Demarest | |
| * All rights reserved. | |
| * | |
| * Redistribution and use in source and binary forms, with or without | |
| * modification, are permitted provided that the following conditions are met: |
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
| /* | |
| NSMutableData+PSYDataWriter.h | |
| Created by Remy "Psy" Demarest on 22/01/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
| NSPoint PSYPointInBezierPath(NSPoint *points, NSInteger pointCount, CGFloat t, | |
| NSPoint *getPoints, NSInteger getPointCount) | |
| { | |
| if(getPointCount > 0 && pointCount == getPointCount) | |
| for(int i = 0; i < getPointCount; i++) | |
| getPoints[i] = points[i]; | |
| if(pointCount <= 1) return *points; | |
| NSPoint *newPoints = calloc(pointCount - 1, sizeof(NSPoint)); |