This file contains hidden or 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
//disable warning:"PerformSelector may cause a leak because its selector is unknown" | |
#pragma clang diagnostic push | |
#pragma clang diagnostic ignored "-Warc-performSelector-leaks" | |
[self.delegate performSelector:self.selector]; | |
#pragma clang diagnostic pop | |
This file contains hidden or 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 hidden or 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 UIImageFromURL( NSURL * URL, void (^imageBlock)(UIImage * image), void (^errorBlock)(void) ) | |
{ | |
dispatch_async( dispatch_get_global_queue( DISPATCH_QUEUE_PRIORITY_DEFAULT, 0 ), ^(void) | |
{ | |
NSData * data = [[[NSData alloc] initWithContentsOfURL:URL] autorelease]; | |
UIImage * image = [[[UIImage alloc] initWithData:data] autorelease]; | |
dispatch_async( dispatch_get_main_queue(), ^(void){ | |
if( image != nil ) | |
{ | |
imageBlock( image ); |
This file contains hidden or 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
// | |
// TWAlertView.h | |
// TWAlertView | |
// | |
// | |
#import <UIKit/UIKit.h> | |
typedef void (^TWAlertBlock)(void); | |
typedef void (^UIAlertConfig)(UIAlertView *); |
This file contains hidden or 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 hidden or 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
[dictionary enumerateKeysAndObjectsUsingBlock:^(id key, id val, BOOL | |
*stop) { | |
//NSLog(@"%@, %@", key, val); | |
}]; |
This file contains hidden or 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
git log | grep "Author" | cut -d" " -f3 | sort | uniq -c | sort -r | |
This file contains hidden or 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
#EXTM3U | |
#EXT-X-VERSION:3 | |
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=690800,CODECS="avc1.66.30,mp4a.40.2",RESOLUTION=576x360 | |
0600/0600.m3u8 | |
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=1460800,CODECS="avc1.66.30,mp4a.40.2",RESOLUTION=576x360 | |
1500/1500.m3u8 | |
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=290400,CODECS="avc1.66.30,mp4a.40.2",RESOLUTION=416x260 | |
0200/0200.m3u8 | |
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=580800,CODECS="avc1.66.30,mp4a.40.2",RESOLUTION=448x280 | |
0400/0400.m3u8 |
This file contains hidden or 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 hidden or 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 |