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 4.2.1 | |
@implementation NSString(EmojiExtension) | |
- (NSString*)removeEmoji { | |
__block NSMutableString* temp = [NSMutableString string]; | |
[self enumerateSubstringsInRange: NSMakeRange(0, [self length]) options:NSStringEnumerationByComposedCharacterSequences usingBlock: | |
^(NSString *substring, NSRange substringRange, NSRange enclosingRange, BOOL *stop){ |
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
#pragma mark - RunLoop Observer | |
- (void)onNewThread:(id)info | |
{ | |
NSRunLoop *runloop = [NSRunLoop currentRunLoop]; | |
if (!runloop) { | |
return ; | |
} | |
if (runloop == [NSRunLoop mainRunLoop]) { |
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 python | |
# -*- coding: utf-8 -*- | |
import random | |
global compareCount | |
def swap(arr, l, r): | |
temp = arr[l] | |
arr[l] = arr[r] |
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
#pragma mark - | |
- (void)drawTestLine | |
{ | |
// test code : draw line between Beijing and Hangzhou | |
CLLocation *location0 = [[CLLocation alloc] initWithLatitude:39.954245 longitude:116.312455]; | |
CLLocation *location1 = [[CLLocation alloc] initWithLatitude:30.247871 longitude:120.127683]; | |
NSArray *array = [NSArray arrayWithObjects:location0, location1, nil]; | |
[self drawLineWithLocationArray:array]; | |
} |
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
// Taken from the commercial iOS PDF framework http://pspdfkit.com. | |
// Copyright (c) 2013 Peter Steinberger. All rights reserved. | |
// Licensed under MIT (http://opensource.org/licenses/MIT) | |
// | |
// You should only use this in debug builds. It doesn't use private API, but I wouldn't ship it. | |
#import <objc/runtime.h> | |
#import <objc/message.h> | |
// Compile-time selector checks. |
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
#pragma mark - reg & unreg notification | |
- (void)regNotification | |
{ | |
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillChangeFrame:) name:UIKeyboardWillChangeFrameNotification object:nil]; | |
} | |
- (void)unregNotification | |
{ | |
[[NSNotificationCenter defaultCenter] removeObserver:self name:UIKeyboardWillChangeFrameNotification object: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
CATransform3D transform = CATransform3DMakeScale(0.001, 0.001, 1.0); | |
hintView.layer.transform = transform; | |
hintView.alpha = 0; | |
transform = CATransform3DMakeScale(1.0, 1.0, 1.0); | |
[UIView beginAnimations:nil context:nil]; | |
[UIView setAnimationDuration:0.5]; | |
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut]; | |
hintView.layer.transform = transform; | |
hintView.alpha = 1; | |
[UIView commitAnimations]; |
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
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions | |
{ | |
self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease]; | |
// Override point for customization after application launch. | |
self.viewController = [[[ViewController alloc] initWithNibName:@"ViewController" bundle:nil] autorelease]; | |
self.window.rootViewController = self.viewController; | |
[self.window makeKeyAndVisible]; | |
UIImageView *splashScreen = [[[UIImageView alloc] initWithFrame:self.window.bounds] autorelease]; | |
splashScreen.image = [UIImage imageNamed:@"Default"]; |
NewerOlder