This file contains 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 <UIKit/UIKit.h> | |
@interface UIView (EasyFrame) | |
@property (nonatomic) CGFloat left; | |
@property (nonatomic) CGFloat top; | |
@property (nonatomic) CGFloat right; | |
@property (nonatomic) CGFloat bottom; | |
@property (nonatomic) CGFloat width; |
This file contains 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
#define DOCUMENTS_PATH [NSHomeDirectory() stringByAppendingString:@"/Documents/"] | |
#ifdef DEBUG | |
# define DLog(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__); | |
#else | |
# define DLog(...) | |
#endif | |
// ALog always displays output regardless of the DEBUG setting | |
#define ALog(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__); |
This file contains 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
NSArray *familyNames = [[NSArray alloc] initWithArray:[UIFont familyNames]]; | |
NSArray *fontNames; | |
NSInteger indFamily, indFont; | |
for (indFamily=0; indFamily<[familyNames count]; ++indFamily) | |
{ | |
NSLog(@"Family name: %@", [familyNames objectAtIndex:indFamily]); | |
fontNames = [[NSArray alloc] initWithArray: | |
[UIFont fontNamesForFamilyName: | |
[familyNames objectAtIndex:indFamily]]]; | |
for (indFont=0; indFont<[fontNames count]; ++indFont) |
This file contains 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
# An example with classes building components. | |
# This stuff is a little fiddly to get set up, | |
# but once it's working it's great - you can just | |
# add new instances of the components, and each | |
# components holds references to all of its | |
# children. You can set defaults & states for each | |
# component separately. | |
# | |
# (try clicking on the post author, and then on each | |
# of the comments on a post) |
This file contains 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
type token = | |
| OpenParen | |
| CloseParen | |
| Number string | |
| String string; | |
type state = | |
| Init | |
| ParsingNumber | |
| ParsingString; |
This file contains 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
type beatle = | |
| John | |
| Paul | |
| George | |
| Ringo; | |
let drummer = Ringo; |
This file contains 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
type shape = | |
| Circle float | |
| Rectangle float float | |
| Prism float float float; | |
let rect = Rectangle 2.5 5.0; |
This file contains 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
type token = | |
| OpenParen | |
| CloseParen | |
| Number string | |
| String string | |
| Name string; |
This file contains 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
type tokenMachine = { | |
current: option token, | |
parsed: list token | |
}; | |
let machine = {current: None, parsed: []}; |
OlderNewer