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
// | |
// From http://stackoverflow.com/questions/4442126/how-to-draw-a-speech-bubble-on-an-iphone | |
// | |
void DrawPopupShapeInRect(CGRect rect, CGColorRef borderColor, CGColorRef backgroundColor, CGFloat borderRadius, CGFloat strokeWidth, CGFloat pointerWidth, CGFloat pointerHeight) | |
{ | |
CGRect currentFrame = self.bounds; | |
CGContextSetLineJoin(context, kCGLineJoinRound); | |
CGContextSetLineWidth(context, strokeWidth); |
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
// | |
// MyLayer.m | |
// | |
// Created by Chris Miles on 14/03/11. | |
// Copyright 2011 Chris Miles. | |
// | |
/* | |
Animate custom property example: |
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
class PaddedTextFieldCell < NSTextFieldCell | |
def drawingRectForBounds(cellFrame) | |
super | |
result = cellFrame | |
padding_left = (result.size.width / 16).round # to make sure text is clear | |
padding_top = (result.size.height / 4).round | |
result.origin.x += padding_left | |
result.origin.y += padding_top |
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
;return address *(long*)$esp | |
;first parameter $rdi | |
;second parameter $rsi | |
;third parameter $rdx | |
;fourth parameter $rcx | |
;fifth parameter $r8 | |
;sixth parameter $r9 | |
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)drawNoiseWithOpacity:(CGFloat)opacity inRect:(CGRect)rect{ | |
static UIImage *noiseImage = nil; | |
static dispatch_once_t oncePredicate; | |
dispatch_once(&oncePredicate, ^{ | |
NSUInteger width = 64, height = 64; | |
NSUInteger size = width*height; | |
char *rgba = (char *)malloc(size); srand(124); | |
for(NSUInteger i=0; i < size; ++i){rgba[i] = rand()%256;} | |
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceGray(); | |
CGContextRef bitmapContext = |
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 OuterClass | |
- (id)init { | |
self = [super init]; | |
if (self == nil) return nil; | |
_outerQueue = dispatch_queue_create(NULL, DISPATCH_QUEUE_CONCURRENT); | |
self.innerObject = [[InnerClass alloc] init]; | |
self.innerObject.delegate = self; |
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
// | |
// FGOManagedObjectContextStack.h | |
// | |
// Created by Indragie Karunaratne on 2012-12-23. | |
// Copyright (c) 2012 Indragie Karunaratne. All rights reserved. | |
// | |
#import <Foundation/Foundation.h> | |
@interface FGOManagedObjectContextStack : NSObject |
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
@interface RACSocketReader : NSObject | |
// Sends a RACSignal whenever there's new data ready to be read. Each signal | |
// will send an NSData upon subscription. | |
// | |
// If you only want the NSData objects as fast as possible, simply -concat | |
// this signal to get a eager signal of NSData values. | |
@property (nonatomic, strong, readonly) RACSignal *signalOfDataSignals; | |
- (id)initWithSocketDescriptor:(int)fildes; |
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
// Defines a yet undocumented method to add a warning if super isn't called. | |
#ifndef NS_REQUIRES_SUPER | |
#if __has_attribute(objc_requires_super) | |
#define NS_REQUIRES_SUPER __attribute((objc_requires_super)) | |
#else | |
#define NS_REQUIRES_SUPER | |
#endif | |
#endif |
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
@interface NSKeyedUnarchiver (Xcode5Fix) | |
@end | |
@implementation NSKeyedUnarchiver (Xcode5Fix) | |
+ (void)load | |
{ | |
[self exchangeInstanceMethod:@selector(decodeInt32ForKey:) | |
withMethod:@selector(xcode5Fix_decodeInt32ForKey:)]; | |
} |
OlderNewer