Skip to content

Instantly share code, notes, and snippets.

@czwen
czwen / surge.config
Created May 27, 2016 15:57
surge.config
# replace @host@ with my host
# replace @port@ with my port
# replace @pw@ with my password
[General]
skip-proxy = 192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12, localhost, *.local
bypass-tun = 192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12
dns-server = 8.8.8.8,223.5.5.5
@czwen
czwen / gist:a1289b842d8f329fde9a17aca6b510f3
Created April 28, 2016 08:40
pod trunk push [path]--allow-warnings
pod trunk push [path]--allow-warnings
@czwen
czwen / atom tree-view hide ignore file
Created April 6, 2016 03:22
atom tree-view hide ignore file
.tree-view {
.status-ignored {
display: none;
}
}
@czwen
czwen / Xcode Show Build Operation Duration
Created March 11, 2016 07:06
Xcode Show Build Operation Duration
defaults write com.apple.dt.Xcode ShowBuildOperationDuration YES
@czwen
czwen / gist:bf6ad74399377bc9701c
Created March 1, 2016 07:20
uiviewcontroller 删除backbutton title
UINavigationItem *item = self.navigationController.navigationBar.topItem;
item.title = @"";
@czwen
czwen / gist:eddb5346fb1d778d9361
Created January 16, 2016 08:57
hide tableview search bar when init
- (void)viewWillAppear:(BOOL)animated{
[super viewWillAppear:animated];
CGPoint contentOffset = self.tableView.contentOffset;
contentOffset.y += CGRectGetHeight(self.tableView.tableHeaderView.frame);
self.tableView.contentOffset = contentOffset;
}
- (void)viewDidAppear:(BOOL)animated{
[super viewDidAppear:animated];
@czwen
czwen / gist:99318ea77b8651f87cdf
Created January 5, 2016 05:57
UITableViewCell set zero separator inset
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath{
// Remove seperator inset
if ([cell respondsToSelector:@selector(setSeparatorInset:)]) {
[cell setSeparatorInset:UIEdgeInsetsZero];
}
// Prevent the cell from inheriting the Table View's margin settings
if ([cell respondsToSelector:@selector(setPreservesSuperviewLayoutMargins:)]) {
[cell setPreservesSuperviewLayoutMargins:NO];
}
@czwen
czwen / gist:921113eb3435e58eb3b6
Created December 1, 2015 07:59
根据commit生成build号
git=`sh /etc/profile; which git`
appBuild=`"$git" rev-list --count HEAD`
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $appBuild" "${TARGET_BUILD_DIR}/${INFOPLIST_PATH}"
echo "Updated ${TARGET_BUILD_DIR}/${INFOPLIST_PATH}"
@czwen
czwen / gist:97e4d7b39d19e275cf6a
Created November 30, 2015 08:26
fuck when UIRefreshControl refresh manually but the tintcolor not change
[UIView animateWithDuration:0.25 delay:0 options:UIViewAnimationOptionBeginFromCurrentState animations:^(void){
self.tableView.contentOffset = CGPointMake(0, -self.refresh.frame.size.height);
} completion:^(BOOL finished) {
[self.refresh beginRefreshing];
[self loadProductsList];
}];
@czwen
czwen / gist:f93045169b058f24bc54
Created November 16, 2015 16:04
node.js problems
$node -v
dyld: bad external relocation length
[1] 46368 trace trap node -v
$ sudo n latest