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
get :upload, :map => "/upload" do | |
render 'Form.haml' | |
end | |
post :upload, :map => "/upload" do | |
@kitten = Kitten.create(:image => params[:file][:tempfile], :type => params[:type], :age => params[:age]) | |
redirect @kitten.save ? "/kitten/#{@kitten.id}" : "/upload" | |
end | |
get :kitten, :map => "/kitten/:id" do |
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
@interface Profile : NSObject { | |
NSString *username; | |
UIImage *image; | |
} | |
- (void)configureWithDictionary:(NSDictionary *)dict; | |
@property (nonatomic, readonly) UIImage *image; | |
@property (nonatomic, readonly) NSString *username; |
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
@implementation Profile | |
- (void)setImage:(UIImage *)img | |
{ | |
[image release]; | |
image = nil; | |
image = [img retain]; | |
} |
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
@interface MyCellView : UIView { | |
Profile *profile; | |
} | |
@property (nonatomic, assign) Profile *profile; |
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
@implementation MyCellView | |
- (void)setProfile:(Profile *)p | |
{ | |
if (profile) | |
{ | |
[profile removeObserver:self forKeyPath:@"image"]; | |
} | |
if (p) |
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
- (void)loadView { | |
self.tableView = [[CMTableView alloc] initWithStyle:UITableViewStyleGrouped]; | |
self.tableView.dataSource = self; | |
self.tableView.delegate = self; | |
self.view = self.tableView; | |
} | |
#pragma mark CMTableView delegate & dataSource | |
- (NSInteger)numberOfSectionsInTableView:(CMTableView *)tableView { | |
return 1; |
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
@implementation RootView | |
- (void)drawRect:(CGRect)rect { | |
self.highlighted ? [[UIColor whiteColor] set] : [[UIColor blackColor] set]; | |
[self.text drawAtPoint:CGPointMake(5, 10) withFont:[UIFont systemFontOfSize:15.0]]; | |
} | |
- (void)setText:(NSString *)t { | |
[m_text release]; | |
m_text = nil; |
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
- (CGSize)sizeConstrainedInRect:(CGRect)rect { | |
CGSize size = CGSizeZero; | |
UIGraphicsBeginImageContextWithOptions(rect.size, YES, self.layer.contentsScale); | |
CGContextRef ctx = UIGraphicsGetCurrentContext(); | |
UIGraphicsPushContext(ctx); | |
[self.layer renderInContext:ctx]; | |
UIGraphicsEndImageContext(); | |
UIGraphicsPopContext(); |
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
Mon Jan 10 07:07:14 Pier-Olivier-Thibaults-MacBook-Pro.local CMCatalog[12792] <Error>: CGContextDrawImage: invalid context 0x0 | |
Mon Jan 10 07:07:14 Pier-Olivier-Thibaults-MacBook-Pro.local CMCatalog[12792] <Error>: CGContextRestoreGState: invalid context 0x0 | |
Mon Jan 10 07:07:14 Pier-Olivier-Thibaults-MacBook-Pro.local CMCatalog[12792] <Error>: CGContextRestoreGState: invalid context 0x0 | |
Mon Jan 10 07:07:14 Pier-Olivier-Thibaults-MacBook-Pro.local CMCatalog[12792] <Error>: CGContextRestoreGState: invalid context 0x0 | |
Mon Jan 10 07:07:14 Pier-Olivier-Thibaults-MacBook-Pro.local CMCatalog[12792] <Error>: CGContextSaveGState: invalid context 0x0 | |
Mon Jan 10 07:07:14 Pier-Olivier-Thibaults-MacBook-Pro.local CMCatalog[12792] <Error>: CGContextSaveGState: invalid context 0x0 | |
Mon Jan 10 07:07:14 Pier-Olivier-Thibaults-MacBook-Pro.local CMCatalog[12792] <Error>: CGContextSetAlpha: invalid context 0x0 | |
Mon Jan 10 07:07:14 Pier-Olivier-Thibaults-MacBook-Pro.local CMCatalog[12792] <Error>: CGContextSaveGState: invalid contex |
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
@interface CoreData () | |
+ (NSURL *)coreServiceDirectory; | |
+ (NSManagedObjectModel *)model; | |
+ (NSPersistentStoreCoordinator *)coordinator; | |
+ (NSManagedObjectContext *)context; | |
+ (NSMutableSet *)coreDataErrors; | |
@end | |
OlderNewer