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)keyboardWillShow:(NSNotification *)notification { | |
NSDictionary *info = [notification userInfo]; | |
NSValue *aValue = [info objectForKey:UIKeyboardFrameEndUserInfoKey]; | |
CGFloat duration = [[info objectForKey:UIKeyboardAnimationDurationUserInfoKey] floatValue]; | |
CGSize keyboardSize = [aValue CGRectValue].size; | |
CGRect viewFrame = CGRectMake(0, | |
0, | |
UI_SCREEN_WIDTH, | |
self.View.frame.size.height - keyboardSize.height); |
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
gradient.frame = CGRectMake(0, 0, 100, 100); | |
gradient.startPoint = CGPointMake(1.0, 1.0); | |
gradient.endPoint = CGPointMake(1.0, 0); | |
gradient.colors = [NSArrayarrayWithObjects:(id)[[UIColorblackColor] CGColor], (id)[[UIColorclearColor] CGColor], nil]; | |
[targenView.layerinsertSublayer:gradient atIndex: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
#define WEB_ARCHIVE @"Apple Web Archive pasteboard type" | |
- (void)getImage { | |
if ([[[UIPasteboard generalPasteboard] pasteboardTypes] containsObject:WEB_ARCHIVE]) { | |
NSData* archiveData = [[UIPasteboard generalPasteboard] valueForPasteboardType:WEB_ARCHIVE]; | |
if (archiveData) | |
{ | |
NSError* error = nil; | |
id webArchive = [NSPropertyListSerialization propertyListWithData:archiveData options:NSPropertyListImmutable format:NULL error:&error]; | |
if (error) { |
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 os | |
import sys | |
import json | |
import getopt | |
import urllib2 | |
import commands | |
import string |
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
#! /bin/bash | |
# File name : convertImage.sh | |
# Author: Mao Jiajun | |
# | |
# print usage | |
usage() { | |
cat << EOF | |
Usage: | |
cropcorner.sh <> <src file> <geometry> <dest file> |
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
APP = LL | |
WORKSPACE = LL | |
CONFIG = AdHoc | |
SCHEME = LLAdHoc | |
ICON_NAME = "[email protected]" | |
BASE_URL = http://ota.nsnotfound.com/ | |
EMAIL_LIST = "[email protected]" | |
EMAIL_DOMAIN = "lexrus.mailgun.org" | |
SFTP_SERVER = [email protected] |
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*)getGrayImage:(UIImage*)sourceImage | |
{ | |
int width = sourceImage.size.width; | |
int height = sourceImage.size.height; | |
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceGray(); | |
CGContextRef context = CGBitmapContextCreate (nil,width,height,8,0,colorSpace,kCGImageAlphaNone); | |
CGColorSpaceRelease(colorSpace); | |
if (context == NULL) { |
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
# 1.install gource using HomeBrew | |
$ brew install gource | |
# 2.install avconv | |
git clone git://git.libav.org/libav.git | |
cd libav | |
# it will take 3-5 minutes to complie, be patient. | |
./configure --disable-yasm | |
make && make install |
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> | |
@interface NSString (JSON) | |
- (id) JSONValue; | |
@end | |
@implementation NSString (JSON) | |
- (id) JSONValue { | |
NSError *error = nil; | |
id obj = [NSJSONSerialization JSONObjectWithData:[self dataUsingEncoding:NSUTF8StringEncoding] options:NSJSONReadingMutableContainers error:&error]; |
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
NSString *path = [NSHomeDirectory() stringByAppendingPathComponent: | |
@"../../Library/Preferences/com.apple.Preferences.plist"]; | |
NSMutableDictionary *dict = | |
[NSMutableDictionary dictionaryWithContentsOfFile:path]; | |
[dict setObject:[NSNumber numberWithBool:YES] forKey:@"KeyboardEmojiEverywhere"]; | |
[dict writeToFile:path atomically:NO]; |
OlderNewer