Skip to content

Instantly share code, notes, and snippets.

View cxa's full-sized avatar
🦥

realazy cxa

🦥
View GitHub Profile
=NEW FEATURES=
- Ready for multitasking and Retina Display
- Print page (iOS 4.2 required)
- Image Gallery for current page
- Share text, image or URL to Delicious, Facebook, Google Reader, Instapaper, Pinboard, Read It Later, Tumblr and/or Twitter
- Add code snippet font size adjustment in Reading Options
=ENHANCEMENTS=
- New image viewer, similar to Photo.app's flavor
- Improved 'Find in Page', similar to desktop browser
@cxa
cxa / Printing
Created November 12, 2010 16:58
iOS 4.2 devices can print wirelessly only to printers that support AirPrint and are running the latest available firmware. Some currently available printers that support AirPrint are:
- HP Photosmart Premium Fax e-All-in-One Printer - C410
- HP Photosmart Premium e-All-in-One Printer series - C310
- HP Photosmart Plus e-All-in-One Printer series - B210
- HP ENVY 100 e-All-in-One Printer Series - D410
- HP Photosmart eStation Printer series - C510
- (NSString *)convertISBN10To13:(NSString *)isbn10
{
NSString *prefix = [NSString stringWithFormat:@"978%@", [isbn10 substringToIndex:9]];
NSInteger sum = 0;
for (int i=0; i<12; i++){
char c = [prefix characterAtIndex:i];
int n = c - '0';
int w = (i % 2) ? 3 : 1;
sum += w * n;
}
- (void)drawRect:(NSRect)rect
{
// Drawing code here.
CGContextRef context = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort];
CGContextSetTextMatrix(context, CGAffineTransformIdentity);
NSAttributedString *str = [[NSAttributedString alloc ]
initWithString:@"学习 Core Text. Learning Core Text. 中华人民共和国。"
attributes:[NSDictionary dictionaryWithObjectsAndKeys:[NSFont fontWithName:@"Adobe Song Std" size:24.0f], (NSString *)kCTFontAttributeName, [NSNumber numberWithBool:YES], (NSString *)kCTVerticalFormsAttributeName, nil]];
CFAttributedStringRef attrString = (CFAttributedStringRef)str;
CTFramesetterRef framesetter = CTFramesetterCreateWithAttributedString(attrString);