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 find / -size +200M -ls | |
sudo find / -size +200M -size -500M -ls |
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
cd /path/to/dir && wget -w 30 -i url-list.txt | |
# run by crond, */5 * * * * bash /path/to/dir/test.sh > /dev/null | |
cd /path/to/dir | |
for i in `ls *.zip`; do | |
unzip -t $i > /dev/null | |
if [[ $? -eq 0 ]]; then | |
mv $i download_done/ |
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
# Files | |
find . -type f | wc -l | |
# Directories | |
find . -type d | wc -l | |
# Block special | |
find . -type b | wc -l | |
# Character special |
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
# last modify time of file | |
stat -f "%m" $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
class ApplicationController < ActionController::Base | |
before_filter :check_token, :only => [some_actions...] | |
def check_token | |
token_file = File.join(Rails.root.to_s, "tmp", "tokens", params[:__token__]) | |
if File.exists?(token_file) | |
require 'fileutils' | |
FileUtils.rm(token_file) | |
return true | |
end | |
false |
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
UITableViewCell reuse problem. | |
appearance: | |
dynamic height cell, with dynamic UILabel... | |
the cell's height is calculated correctly, but the label shows wrong. | |
cell display incorrect before reuse, after reused, everything displays well. | |
in CostomCell's layoutSubviews method, each subview's frame is right if you print them. | |
reason: | |
App's using xib to draw custom UITableViewCell. |
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) tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath { | |
// somecode | |
[self performSelectorInBackground:@selector(loadMoreData:) withObject:nil]; | |
} | |
- (void) loadMoreData:(id) s { | |
// some code to pull data from remote | |
dispatch_async(dispatch_get_main_queue(), ^{ | |
[self.tableView reloadData]; | |
}); |
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
当 layoutSubviews 里设置了 frame 但是界面不刷新时,检查一下 xib 里面是不是勾上了 use Autolayout ,把这个去掉就好 | |
When you have set frame in layoutSubviews but it do not refresh the view, we should uncheck the [use Autolayout] in xib. |
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
create: | |
git tag tagname | |
push to master: | |
git push --tags | |
list tags: | |
git tag --list | |
git tag -l |
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 "MobClickOpenUDID+Swizzled.h" | |
#import <objc/message.h> | |
#import <JRSwizzle.h> // Swizzle 类方法,这样可以避免类去调用某些Apple可能不允许的方法,通过审核 | |
#import "YourDevice.h" // 你的设备相关类,用于生成自己的Device Unique ID | |
#import <RegExCategories.h> // 正则表达式 | |
#import <NSString+Ruby.h> // 字符串工具类 | |
static NSString * const kOpenUDIDKey = @"OpenUDID"; | |
static NSString * const kOpenUDIDSlotKey = @"OpenUDID_slot"; |
OlderNewer