Skip to content

Instantly share code, notes, and snippets.

@pklaus
pklaus / get_name.py
Last active January 26, 2024 18:20 — forked from starrhorne/gist:1637310
Extracting font names from TTF/OTF files using Python and fontTools
#!/usr/bin/env python
"""
From
https://github.com/gddc/ttfquery/blob/master/ttfquery/describe.py
and
http://www.starrhorne.com/2012/01/18/how-to-extract-font-names-from-ttf-files-using-python-and-our-old-friend-the-command-line.html
ported to Python 3
"""
@danieljfarrell
danieljfarrell / NSimageToCGColorRef.mm
Created January 26, 2013 10:35
Functions to convert an NSImage (*pattern image*) to a CGColorRef color, following the advice from http://stackoverflow.com/questions/2520978/how-to-tile-the-contents-of-a-calayer
/* http://stackoverflow.com/questions/2520978/how-to-tile-the-contents-of-a-calayer */
// callback for CreateImagePattern.
static void DrawPatternImage (void *info, CGContextRef ctx) {
CGImageRef image = (CGImageRef) info;
CGContextDrawImage(ctx,
CGRectMake(0,0, CGImageGetWidth(image),CGImageGetHeight(image)),
image);
}
@Jaybles
Jaybles / UIDeviceHardware.h
Created October 28, 2011 19:33
UIDeviceHardware - Determine iOS device being used
//
// UIDeviceHardware.h
//
// Used to determine EXACT version of device software is running on.
#import <Foundation/Foundation.h>
@interface UIDeviceHardware : NSObject
- (NSString *) platform;