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
| sudo tcpdump -i en0 -nn -s0 -A -l|grep --line-buffered "Host: \|GET " |
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. Make sure you have nginx sub module compiled in | |
| # nginx -V 2>&1 | grep --color=always '\-\-with\-http_sub_module' | |
| # 2. add two directives below at HTTP level | |
| # nginx.conf | |
| http { | |
| # ...... | |
| sub_filter '</head>' '<style type="text/css">html{ filter:progid:DXImageTransform.Microsoft.BasicImage(grayscale=1); -webkit-filter: grayscale(100%); filter: url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\'><filter id=\'grayscale\'><feColorMatrix type=\'matrix\' values=\'0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0\'/></filter></svg>#grayscale"); /* Firefox 10+, Firefox on Android */ |
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
| " General Settings | |
| set expandtab | |
| set tabstop=4 | |
| set shiftwidth=4 | |
| set softtabstop=4 | |
| set nocompatible " We're running Vim, not Vi! | |
| set noswapfile " No swap files | |
| set visualbell t_vb= " No visual bell | |
| set ai " auto indenting | |
| set history=100 " keep 100 lines of history |
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
| 通过读取系统网络接口信息,获取当前iphone设备的流量相关信息,统计的是上次开机至今的流量信息. 2 | |
| 倒入库: | |
| [html] view plaincopy | |
| SystemConfiguration.framework | |
| 加入头文件: | |
| [html] view plaincopy | |
| #include <ifaddrs.h> | |
| #include <sys/socket.h> | |
| #include <net/if.h> |
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
| 一.问题 | |
| 使用UITableViewStylePlain类型的tableView时,如果将separatorStyle设置为UITableViewCellSeparatorStyleSingleLine,就会在每行的下边自动显示一条线,即使是空行也会显示,这样在tableView中无数据时就只会显示一条一条的线,这样可能不是我们想要的效果,如图所示: | |
| 空表: | |
| 有数据的表: | |
| 二.解决方法 | |
| 有一个简单的方法可以将空行的线去除,即在tableView中添加一个tableFooterView,如果不需要tableFooterView显示什么数据,可以直接添加个空view。 | |
| tableView.tableFooterView = [[UIView alloc]init]; | |
| 三. 结果 |
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、关于使用 CGImageCreateWithMask(<#CGImageRef image#>, <#CGImageRef mask#>)来进行掩码时。 | |
| 情况一:第二个参数是用CGImageMaskCreate创建生成的 image mask。 | |
| 那么就会是黑色部分出现,白色部分消失。 | |
| CGImageRef topRef = mask.CGImage; | |
| CGImageRef maskImage = CGImageMaskCreate(CGImageGetWidth(topRef), CGImageGetHeight(topRef), CGImageGetBitsPerComponent(topRef), CGImageGetBitsPerPixel(topRef), CGImageGetBytesPerRow(topRef), CGImageGetDataProvider(topRef), CGImageGetDecode(topRef), false); | |
| // CGImageRef target = CGImageCreateWithMask(origin.CGImage, maskImage); | |
| // UIImage * image = [UIImage imageWithCGImage:target]; | |
| //release |
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
| defaults write com.apple.dt.xcode IDEIndexDisable 1 |
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
| #define ApplicationDelegate ((AppDelegate *)[[UIApplication sharedApplication] delegate]) | |
| #define UserDefaults [NSUserDefaults standardUserDefaults] | |
| #define NotificationCenter [NSNotificationCenter defaultCenter] | |
| #define SharedApplication [UIApplication sharedApplication] | |
| #define Bundle [NSBundle mainBundle] | |
| #define MainScreen [UIScreen mainScreen] | |
| #define ShowNetworkActivityIndicator() [UIApplication sharedApplication].networkActivityIndicatorVisible = YES | |
| #define HideNetworkActivityIndicator() [UIApplication sharedApplication].networkActivityIndicatorVisible = NO | |
| #define NetworkActivityIndicatorVisible(x) [UIApplication sharedApplication].networkActivityIndicatorVisible = x | |
| #define NavBar self.navigationController.navigationBar |
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
| <key>CFBundleIcons</key> | |
| <dict> | |
| <key>CFBundlePrimaryIcon</key> | |
| <dict> | |
| <key>CFBundleIconFiles</key> | |
| <array> | |
| <string>myIcon.png</string> | |
| </array> | |
| <key>UIPrerenderedIcon</key> | |
| <true/> |
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
| markdown语法快速成文,git与github实时保存,jekyll或octopress实时成书或者showoff实时成ppt。入门略有门槛,但是习惯了,写作效率会好很多。以下以octopress为例,进行说明。 | |
| 配置个人github账号 | |
| 登陆github,创建一个个人账号。假设叫做:rubyonchina。 | |
| 然后回到ubuntu或者Mac里面,仍然是在终端里面,输入: | |
| [[ -f ~/.ssh/id_rsa.pub ]] || ssh-keygen -t rsa | |
| 按照默认提示一路确认,生成密钥之后,将生成的信息复制到github页面中,如下所示: |