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
//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]; |
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
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]; | |
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
//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. |
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
NSURLCache *sharedCache = [[NSURLCache alloc] initWithMemoryCapacity:0 diskCapacity:0 diskPath:nil]; | |
[NSURLCache setSharedURLCache:sharedCache]; | |
[sharedCache release]; |
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
+(UIView *)fetchViewFromNib:(NSString *)nibName withClass:(Class)viewClass { | |
NSArray *nibObjects = [[NSBundle mainBundle] loadNibNamed:nibName owner:nil options:nil]; | |
UIView *view = nil; | |
for (id object in nibObjects) { | |
if ([object isKindOfClass:viewClass]) { | |
view = object; |
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
+(UIView *)fetchViewFromNib:(NSString *)nibName withClass:(Class)viewClass { | |
NSArray *nibObjects = [[NSBundle mainBundle] loadNibNamed:nibName owner:nil options:nil]; | |
UIView *view = nil; | |
for (id object in nibObjects) { | |
if ([object isKindOfClass:viewClass]) { | |
view = object; |
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
#import <UIKit/UIKit.h> | |
@interface UIView (Utils) | |
-(UIViewController *)parentViewController; | |
@end |
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
#! /usr/bin/env ruby | |
require 'RMagick' | |
def resize_image (image_path, write_path) | |
image = Magick::Image.read(image_path).first | |
new_image = image.scale(0.5) | |
puts "Writing image #{write_path}..." | |
new_image.write(write_path) | |
end |
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
(add-to-list 'load-path "~/.emacs.d") | |
(require 'cc-mode) | |
(require 'autopair) | |
(autopair-global-mode) | |
(define-key c-mode-base-map (kbd "RET") 'newline-and-indent) | |
(global-linum-mode t) | |
(setq-default c-basic-offset 4 | |
tab-width 8 | |
indent-tabs-mode t) |
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
task uploadTf(dependsOn: assembleRelease) << { | |
def teamToken = '<TestFlight team token here>' | |
def apiToken = '<TestFlight api token here>' | |
def lists = '<TestFlight distribution lists here>' | |
def apk = file("build/apk/$project.name-release.apk") | |
def notes = new File(file('changelog.mdown')).getText("UTF-8") | |
def http = new HTTPBuilder('http://testflightapp.com') | |
println('Uploading build to TestFlight...') | |
http.request(POST, JSON) { req -> | |
uri.path = '/api/builds.json' |
OlderNewer