Simple visual illustrations of how CGRectDivideWithPadding works.
+-------+---------+------------>
e | | |
d | slice | padding | remainder…
g | | |
e | | |
// clang -framework Foundation -fobjc-arc -O3 test.m | |
#import <Foundation/Foundation.h> | |
@interface Slice : NSObject | |
@property NSInteger start; | |
@property NSInteger length; | |
@end | |
@implementation Slice |
// clang -framework Foundation -fobjc-arc -O3 test.m | |
#import <Foundation/Foundation.h> | |
@interface NSNumber (RangeCreation) | |
- (NSValue *): (NSInteger)length; | |
@end |
// | |
// NSUserDefaults+ObjectSubscripting.h | |
// | |
// Created by Tony Arnold on 29/07/12. | |
// Copyright (c) 2012 The CocoaBots. All rights reserved. | |
// | |
#import <Foundation/Foundation.h> | |
@interface NSUserDefaults (ObjectSubscripting) |
// Smart little helper to find main thread hangs. Enable in appDidFinishLaunching. | |
// Only available with source code in DEBUG mode. | |
@interface PSPDFHangDetector : NSObject | |
+ (void)startHangDetector; | |
@end | |
@implementation PSPDFHangDetector | |
+ (void)startHangDetector { | |
#ifdef DEBUG |
extern void CGPathPrint(CGPathRef path, FILE* file); | |
CGPathPrint(path.CGPath, NULL); | |
Path 0xb44e380: | |
moveto (-12, 295) | |
lineto (115, 295) | |
lineto (108, -12) | |
lineto (235, -12) |
Simple visual illustrations of how CGRectDivideWithPadding works.
+-------+---------+------------>
e | | |
d | slice | padding | remainder…
g | | |
e | | |
# turtle.py | |
# Basic Turtle graphics module for Pythonista | |
# | |
# When run as a script, the classic Koch snowflake is drawn as a demo. | |
# The module can also be used interactively or from other scripts: | |
# >>> from turtle import * | |
# >>> right(30) | |
# >>> forward(100) | |
# ... |
Let's say you have an iOS project, and you want to use some external library, like AFNetworking. How do you integrate it?
Add the project to your repo:
git submodule add [email protected]:AFNetworking/AFNetworking.git Vendor/AFNetworking
or something to that effect.
Using HockeySDK as an example
ARCH=armv7
FRAMEWORK_DIRECTORY="${HOME}/Downloads/HockeySDK-iOS-3/HockeySDK.embeddedframework"
FRAMEWORK_NAME=$(basename `echo "${FRAMEWORK_DIRECTORY}"/*.framework` .framework)
module WillPaginate | |
module ActionView | |
def will_paginate(collection = nil, options = {}) | |
options[:renderer] ||= FoundationLinkRenderer | |
super.try :html_safe | |
end | |
class FoundationLinkRenderer < LinkRenderer | |
protected |