Skip to content

Instantly share code, notes, and snippets.

View srgtuszy's full-sized avatar

Michał Tuszyński srgtuszy

View GitHub Profile
@srgtuszy
srgtuszy / IAMultipartRequestGenerator.h
Created May 8, 2011 18:42
Easy and lightweight Multipart form data requests with CFNetwork. You can use it freely in free and commercial projects.
//IAMultipartRequestGenerator.h
//
//Author: Michal Tuszynski
//
//Easy Multipart Request Generator
//This program is free software: you can redistribute it and/or modify
//it under the terms of the GNU General Public License as published by
//the Free Software Foundation, either version 3 of the License, or
//(at your option) any later version.
@srgtuszy
srgtuszy / WebViewContent
Created May 5, 2011 11:07
UIWebView content size without javascript
CGRect webViewFrame = [self.webView frame];
webViewFrame.size.height = 1;
[self.webView setFrame:webViewFrame];
CGSize fittingSize = [self.webView sizeThatFits:CGSizeZero];
webViewFrame.size = fittingSize;
[self.webView setFrame:webViewFrame];
@srgtuszy
srgtuszy / CGImageCropping.m
Created March 28, 2011 14:41
Easy image cropping with core graphics
//The image to be cropped
UIImage *image;
//The rect to which the image is going to be cropped
CGRect croppedRect = CGRectMake(0, 0, 40, 40);
//A simple call to Core Graphics function
CGImageRef img = CGImageCreateWithImageInRect(image.CGImage, croppedRect);
//There goes the cropped image
UIImage *result = [[UIImage alloc] initWithCGImage:img] autorelease];