Skip to content
Koke

Koke's Journal

Mobile Engineer @ Automattic, making WooCommerce for iOS

Tag: code

Duplicated error messages

A retweet wasn’t enough this time. If you work with APIs you’ll relate to this (baby is optional)

Having a baby has really driven home how terrible it is when several issues result in the same error message

— Andrew Traviss (@andrewtraviss) October 18, 2013

Jorge Bernal Programming Leave a comment October 18, 2013 1 Minute

Dealing with CGRects

If you’ve ever written code like this:

  CGSize size = self.bounds.size;
  CGRect r = CGRectMake(MARGIN, MARGIN, size.width - 2*MARGIN, size.height - 2*MARGIN);

Do this instead:

  CGRect r = CGRectInset(self.bounds, MARGIN, MARGIN);

And while you’re at it, go read about CGGeometry

Jorge Bernal Programming Leave a comment February 4, 2013 1 Minute

[sourcecode lang=objc] – (void)cancelVie…

- (void)cancelView:(id)sender {
    [self cancelView:sender];
}

Probably the most stupid looking code I’ve written in a long time.

In my defense, I’m in the early stages of merging two huge classes, so stuff like this was expected. Still looks stupid

Jorge Bernal Photos Leave a comment January 22, 2011 1 Minute

What I probably miss the most in Objective-C

@implementation NSString (numericValue)
- (NSNumber *)numericValue {
    return [NSNumber numberWithInt:[self intValue]];
}
@end
Jorge Bernal Programming Leave a comment December 28, 2010 1 Minute
Proudly powered by WordPress | Theme: Independent Publisher 2 by Raam Dev.