Pastie now auto-senses if line-wrap is a bad or good idea. Feedback?
## mark a section (Learn more)
#import <Foundation/Foundation.h> int main (int argc, char const* argv[]) { NSAutoreleasePool* pool = [NSAutoreleasePool new]; NSString* url = @"http://update.macromates.com/check"; char const* fields = "type=nightly"; NSMutableURLRequest* request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:url]]; [request setCachePolicy:NSURLRequestReloadIgnoringCacheData]; [request setHTTPMethod:@"POST"]; [request setHTTPBody:[NSData dataWithBytes:fields length:strlen(fields)]]; [request setValue:@"Test/1" forHTTPHeaderField:@"User-Agent"]; NSError* error = nil; NSData* dataReply = [NSURLConnection sendSynchronousRequest:request returningResponse:NULL error:&error]; if(!dataReply || error) NSLog(@"error: %@", [error localizedDescription]); else if(id dict = [NSPropertyListSerialization propertyListFromData:dataReply mutabilityOption:NSPropertyListImmutable format:nil errorDescription:NULL]) NSLog(@"reply: %@", dict); else NSLog(@"reply: %@", dataReply); [pool release]; return 0; }
This paste will be private.
From the Design Piracy series on my blog: