Skip to content

Instantly share code, notes, and snippets.

View pier-oliviert's full-sized avatar

Pier-Olivier Thibault pier-oliviert

View GitHub Profile
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
@interface Profile : NSObject {
NSString *username;
UIImage *image;
}
- (void)configureWithDictionary:(NSDictionary *)dict;
@property (nonatomic, readonly) UIImage *image;
@property (nonatomic, readonly) NSString *username;
@implementation Profile
- (void)setImage:(UIImage *)img
{
[image release];
image = nil;
image = [img retain];
}
@interface MyCellView : UIView {
Profile *profile;
}
@property (nonatomic, assign) Profile *profile;
@implementation MyCellView
- (void)setProfile:(Profile *)p
{
if (profile)
{
[profile removeObserver:self forKeyPath:@"image"];
}
if (p)
- (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;
@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;
- (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();
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
@interface CoreData ()
+ (NSURL *)coreServiceDirectory;
+ (NSManagedObjectModel *)model;
+ (NSPersistentStoreCoordinator *)coordinator;
+ (NSManagedObjectContext *)context;
+ (NSMutableSet *)coreDataErrors;
@end