This file contains hidden or 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
| // | |
| // CoreTextLabel.h | |
| // Frost | |
| // | |
| // Created by David Kasper on 10/1/12. | |
| // | |
| #import <UIKit/UIKit.h> | |
| #import <CoreText/CoreText.h> |
This file contains hidden or 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 tornado.ioloop | |
| import tornado.web | |
| from datetime import datetime | |
| import urlparse | |
| from bson.json_util import dumps | |
| import pymongo | |
| from pymongo import Connection | |
| class Home(tornado.web.RequestHandler): |
This file contains hidden or 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
| http://stackoverflow.com/questions/7979592/is-it-possible-to-select-the-text-rendered-by-core-text-in-iphone |
This file contains hidden or 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
| // A small chunk of it. | |
| - (void)tapGestureAction:(UITapGestureRecognizer *)gesture | |
| { | |
| CGPoint location = [gesture locationInView:self]; | |
| _linkLocation = location; | |
| location.y += (ARTICLE_BODY_FONT_SIZE / lineHeightFactor); | |
| CFArrayRef lines = CTFrameGetLines(_frame); | |
This file contains hidden or 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
| // CTTest.c | |
| #include <ApplicationServices/ApplicationServices.h> | |
| CFDictionaryRef findFeatureByName(CFArrayRef features, const char *name) | |
| { | |
| CFDictionaryRef feature = NULL; | |
| CFStringRef featureName = CFStringCreateWithCString(NULL, name, kCFStringEncodingUTF8); | |
| CFIndex i; | |
| for (i = 0; i < CFArrayGetCount(features); i++) { |
This file contains hidden or 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 CGRect clipRectToPath(CGRect rect, CGPathRef path) | |
| { | |
| size_t width = floorf(rect.size.width); | |
| size_t height = floorf(rect.size.height); | |
| uint8_t *points = calloc(width * height, sizeof(*points)); | |
| CGContextRef bitmapContext = CGBitmapContextCreate(points, width, height, sizeof(*points) * 8, width, NULL, kCGImageAlphaOnly); | |
| BOOL atStart = NO; | |
| NSRange range = NSMakeRange(0, 0); | |
| NSUInteger x = 0; |
This file contains hidden or 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 <ApplicationServices/ApplicationServices.h> | |
| #import <Foundation/Foundation.h> | |
| int main(int argc, char *argv[]) | |
| { | |
| if (argc != 2) | |
| return 0; | |
| NSAutoreleasePool *pool = [NSAutoreleasePool new]; | |
| CFStringRef name = (CFStringRef) [NSString stringWithUTF8String: argv[1]]; |
This file contains hidden or 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
| //Core Graphics method | |
| CGDataProviderRef provider = CGDataProviderCreateWithURL((__bridge CFURLRef)fontURL); | |
| CGFontRef graphicsFont = CGFontCreateWithDataProvider(provider); | |
| CTFontRef coreTextFont = CTFontCreateWithGraphicsFont(graphicsFont, fontSize, /*matrix*/ NULL, /*attributes*/ NULL); | |
| if (coreTextFont) { | |
| NSFont *font = (__bridge NSFont *)coreTextFont; | |
| [fonts addObject:font]; | |
| CFRelease(coreTextFont); | |
| } | |
| CGFontRelease(graphicsFont); |
This file contains hidden or 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 <Foundation/Foundation.h> | |
| @interface AClass (ACategory) | |
| @end |
This file contains hidden or 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 ast | |
| import sys | |
| import pprint | |
| import re | |
| type_lookup = { | |
| ast.Module: 'Module', | |
| ast.FunctionDef: 'Function', | |
| ast.ClassDef: 'Class' | |
| } |