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
#include <objc/runtime.h> | |
#include <objc/message.h> | |
+ (void)printClassMethods:(Class)class { | |
NSLog(@"Methods in %@", NSStringFromClass(class)); | |
unsigned int out_count = 0; | |
Method *class_methods = class_copyMethodList(class, &out_count); | |
for (int i = 0; i < out_count; i++) { | |
Method m = class_methods[i]; | |
NSLog(@"\t%@", NSStringFromSelector(method_getDescription(m)->name)); |
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
#!/bin/bash | |
# Usage: find . -name "epg_cell_bg_*" -exec ./round_corners.sh '{}' \; | |
convert $1 \( +clone -alpha extract -draw 'fill black polygon 0,0 0,3 3,0 fill white circle 3,3, 3,0' \( +clone -flip \) \ | |
-compose Multiply -composite \( +clone -flop \) -compose Multiply -composite \) -alpha off \ | |
-compose CopyOpacity -composite $1 |
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 <UIKit/UIKit.h> | |
@interface UIView (SMFrameAdditions) | |
@property (nonatomic, assign) CGPoint $origin; | |
@property (nonatomic, assign) CGSize $size; | |
@property (nonatomic, assign) CGFloat $x, $y, $width, $height; // normal rect properties | |
@property (nonatomic, assign) CGFloat $left, $top, $right, $bottom; // these will stretch the rect | |
@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
-(float) get_free_memory { | |
mach_port_t host_port; | |
mach_msg_type_number_t host_size; | |
vm_size_t pagesize; | |
host_port = mach_host_self(); | |
host_size = sizeof(vm_statistics_data_t) / sizeof(integer_t); | |
host_page_size(host_port, &pagesize); | |
vm_statistics_data_t vm_stat; | |
if (host_statistics(host_port, HOST_VM_INFO, (host_info_t)&vm_stat, &host_size) != KERN_SUCCESS) { |
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
CGRect CGRectIntegralScaledEx(CGRect rect, CGFloat scale) | |
{ | |
return CGRectMake(floorf(rect.origin.x * scale) / scale, floorf(rect.origin.y * scale) / scale, ceilf(rect.size.width * scale) / scale, ceilf(rect.size.height * scale) / scale); | |
} | |
CGRect CGRectIntegralScaled(CGRect rect) | |
{ | |
return CGRectIntegralScaledEx(rect, [[UIScreen mainScreen] scale]); | |
} |
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
#=============================================================================== | |
# Filename: boost.sh | |
# Author: Pete Goodliffe | |
# Copyright: (c) Copyright 2009 Pete Goodliffe | |
# Licence: Please feel free to use this, with attribution | |
# Modified version | |
#=============================================================================== | |
# | |
# Builds a Boost framework for the iPhone. | |
# Creates a set of universal libraries that can be used on an iPhone and in the |
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 BOOL PSPDFIsDevelopmentBuild(void) { | |
#if TARGET_IPHONE_SIMULATOR | |
return YES; | |
#else | |
static BOOL isDevelopment = NO; | |
static dispatch_once_t onceToken; | |
dispatch_once(&onceToken, ^{ | |
// There is no provisioning profile in AppStore Apps. | |
NSData *data = [NSData dataWithContentsOfFile:[NSBundle.mainBundle pathForResource:@"embedded" ofType:@"mobileprovision"]]; | |
if (data) { |