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
#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
# 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
# Define the model. All views will listen to this and update themselves, and will only have to deal with this model, instead of dealing with other views | |
# Extend BaseClass so we can use the on/emit bindings | |
class Model extends Framer.BaseClass | |
# Define properties that we want to observe like this so we can call `.index =` instead of .setIndex, though that works too | |
@define "index", | |
get: ()-> @_index || 0 | |
set: (i) -> | |
@_index = i | |
# Emit the change so other things can listen to it (probably the views) | |
@emit "change:index" |
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
// 22: class - creation | |
// To do: make all tests pass, leave the assert lines unchanged! | |
describe('class creation', () => { | |
it('is as simple as `class XXX {}`', function() { | |
class TestClass {} | |
const instance = new TestClass(); | |
assert.equal(typeof instance, 'object'); |
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
git fetch -p && git branch -vv | awk '/: gone]/{print $1}' | xargs git branch -d |
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; |
OlderNewer