Skip to content

Instantly share code, notes, and snippets.

@billgarrison
billgarrison / textmate-spin-report.txt
Last active August 29, 2015 13:57
Textmate Spin Report
Sampling process 747 for 3 seconds with 1 millisecond of run time between samples
Sampling completed, processing symbols...
Analysis of sampling TextMate (pid 747) every 1 millisecond
Process: TextMate [747]
Path: /Applications/TextMate.app/Contents/MacOS/TextMate
Load Address: 0x10f456000
Identifier: com.macromates.TextMate.preview
Version: 2.0-alpha.9515 (9515)
Code Type: X86-64
Parent Process: launchd [170]
/**
Provides the ability to verify key paths at compile time.
If "keyPath" does not exist, a compile-time error will be generated.
Example:
// Verifies "isFinished" exists on "operation".
NSString *key = SQKeyPath(operation, isFinished);
// Verifies "isFinished" exists on self.
//
// RVNReceiptValidation.m
//
// Created by Satoshi Numata on 12/06/30.
// Copyright (c) 2012 Sazameki and Satoshi Numata, Ph.D. All rights reserved.
//
// This sample shows how to write the Mac App Store receipt validation code.
// Replace kRVNBundleID and kRVNBundleVersion with your own ones.
//
// This sample is provided because the coding sample found in "Validating Mac App Store Receipts"
// Usage example:
// input image: http://f.cl.ly/items/3v0S3w2B3N0p3e0I082d/Image%202011.07.22%2011:29:25%20PM.png
//
// UIImage *buttonImage = [UIImage ipMaskedImageNamed:@"UIButtonBarAction.png" color:[UIColor redColor]];
// .h
@interface UIImage (IPImageUtils)
+ (UIImage *)ipMaskedImageNamed:(NSString *)name color:(UIColor *)color;
@end
//
// RVNReceiptValidation.m
//
// Created by Satoshi Numata on 12/06/30.
// Copyright (c) 2012 Sazameki and Satoshi Numata, Ph.D. All rights reserved.
//
// This sample shows how to write the Mac App Store receipt validation code.
// Replace kRVNBundleID and kRVNBundleVersion with your own ones.
//
// This sample is provided because the coding sample found in "Validating Mac App Store Receipts"
@billgarrison
billgarrison / gist:6046064
Created July 20, 2013 18:52
Function than constructs an NSError from the current SQLite3 engine error state in a thread-safe manner.
NSString *SQLiteErrorDomain = @"SQLiteErrorDomain";
NSError *SQLiteError(sqlite3 *db) {
NSError *error = nil;
if (db) {
/* Lock the database connection to prevent other activity from disturbing the currently recorded internal error code and message.
*/
/* Ref: <http://indieambitions.com/idevblogaday/perform-blur-vimage-accelerate-framework-tutorial/> */
- (UIImage *)blurryImage:(UIImage *)image withBlurLevel:(CGFloat)blur {
if (blur < 0.f || blur > 1.f) {
blur = 0.5f;
}
int boxSize = (int)(blur * 100);
boxSize = boxSize - (boxSize % 2) + 1;
CGImageRef img = image.CGImage;
@interface SomeViewController ()
// Declare some collection properties to hold the various updates we might get from the NSFetchedResultsControllerDelegate
@property (nonatomic, strong) NSMutableIndexSet *deletedSectionIndexes;
@property (nonatomic, strong) NSMutableIndexSet *insertedSectionIndexes;
@property (nonatomic, strong) NSMutableArray *deletedRowIndexPaths;
@property (nonatomic, strong) NSMutableArray *insertedRowIndexPaths;
@property (nonatomic, strong) NSMutableArray *updatedRowIndexPaths;
@end
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]);
}
@billgarrison
billgarrison / README.md
Created February 22, 2013 05:57 — forked from 0xced/README.md

Using HockeySDK as an example

  1. Download HockeySDK 3.0.0

  2. Run this command:

     echo "int main(int argc, char *argv[]) { return 0; }" | clang -x c -arch armv7 -ObjC -isysroot `xcode-select -print-path`/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk -Xlinker -objc_abi_version -Xlinker 2 -F$HOME/Downloads/HockeySDK-iOS-3/HockeySDK.embeddedframework -framework HockeySDK -framework Foundation -framework UIKit -framework QuartzCore -framework CoreGraphics -framework CoreText -o $TMPDIR/HockeySDK - && class-dump $TMPDIR/HockeySDK
    

Adapt all the -framework options according to the documentation that comes with the iOS static framework.