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
- (UIImage *)compressImage:(UIImage *)image{ | |
float actualHeight = image.size.height; | |
float actualWidth = image.size.width; | |
float maxHeight = 600.0; | |
float maxWidth = 800.0; | |
float imgRatio = actualWidth/actualHeight; | |
float maxRatio = maxWidth/maxHeight; | |
float compressionQuality = 0.5;//50 percent compression | |
if (actualHeight > maxHeight || actualWidth > maxWidth) { |
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
// An example viewDidLoad | |
- (void)viewDidLoad | |
{ | |
[super viewDidLoad]; | |
[self loadWebView]; | |
} | |
// The example loader | |
// | |
// Assumes you have an IBOutlet for the UIWebView defined: @property (strong, nonatomic) UIWebView *wv; |
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
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event | |
{ | |
// dismiss keyboard when background is touched | |
[self.view endEditing:YES]; | |
} |
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
sudo su postgres | |
psql | |
update pg_database set datistemplate=false where datname='template1'; | |
drop database Template1; | |
create database template1 with owner=postgres encoding='UTF-8' | |
lc_collate='en_US.utf8' lc_ctype='en_US.utf8' template template0; | |
update pg_database set datistemplate=true where datname='template1'; |
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 <Foundation/Foundation.h> | |
#import "Contact.h" | |
@interface AddressBookManager : NSObject | |
+ (NSString *)nameForContactWithPhoneNumber:(NSString *)phoneNumber; | |
+ (UIImage *)photoForContactWithPhoneNumber:(NSString *)phoneNumber; | |
@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
- (UIImage *)drawTextOnImage:(NSString *)text :(UIImage *)img { | |
UIGraphicsBeginImageContext(img.size); | |
CGRect imageBoundaries = CGRectMake(0,0, img.size.width, img.size.height); | |
[img drawInRect:imageBoundaries]; | |
[[UIColor grayColor] set]; | |
[text drawInRect:imageBoundaries withFont:[UIFont boldSystemFontOfSize:15] lineBreakMode:NSLineBreakByTruncatingTail alignment:NSTextAlignmentCenter]; | |
UIImage *theImage=UIGraphicsGetImageFromCurrentImageContext(); |
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
package kr.pe.meinside.android.apkx; | |
import java.io.DataInputStream; | |
import java.io.IOException; | |
import java.util.zip.CRC32; | |
import kr.pe.meinside.android.apkx.sampleapp.R; | |
import android.app.Activity; | |
import android.app.PendingIntent; | |
import android.content.Intent; |
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
# xcode-build-bump.sh | |
# @desc Auto-increment the build number every time the project is run. | |
# @usage | |
# 1. Select: your Target in Xcode | |
# 2. Select: Build Phases Tab | |
# 3. Select: Add Build Phase -> Add Run Script | |
# 4. Paste code below in to new "Run Script" section | |
# 5. Drag the "Run Script" below "Link Binaries With Libraries" | |
# 6. Insure that your starting build number is set to a whole integer and not a float (e.g. 1, not 1.0) |
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 "ParseApiClient.h" | |
static NSString * const kSDFParseAPIBaseURLString = @"https://api.parse.com/1/"; | |
static NSString * const kSDFParseAPIApplicationId = YOUR_APPLICATION_ID; | |
static NSString * const kSDFParseAPIKey = YOUR_PARSE_API_KEY; | |
@implementation ParseApiClient | |
+ (ParseApiClient *)sharedClient { | |
static ParseApiClient *sharedClient = nil; |
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
NSArray *allEntities = [NSManagedObjectModel MR_defaultManagedObjectModel].entities; | |
[allEntities enumerateObjectsUsingBlock:^(NSEntityDescription *entityDescription, NSUInteger idx, BOOL *stop) { | |
[NSClassFromString([entityDescription managedObjectClassName]) MR_truncateAll]; | |
}]; |
OlderNewer