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) 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 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
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 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
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 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
# last modify time of file | |
stat -f "%m" $file |
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
# Files | |
find . -type f | wc -l | |
# Directories | |
find . -type d | wc -l | |
# Block special | |
find . -type b | wc -l | |
# Character special |
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
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 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 find / -size +200M -ls | |
sudo find / -size +200M -size -500M -ls |
NewerOlder