Skip to content

Instantly share code, notes, and snippets.

View hqlulu's full-sized avatar
🎯
Focusing

阿权 hqlulu

🎯
Focusing
  • beijing
View GitHub Profile
$handle = fopen("inputfile.txt", "r");
if ($handle) {
while (($line = fgets($handle)) !== false) {
// process the line read.
}
fclose($handle);
} else {
// error opening the file.
}
<?php
$array = ["周日","周一","周二","周三","周四","周五","周六"];
$time=date("w",time());
echo $array[$time];
@hqlulu
hqlulu / gist:ffeaac0e7273be723e5bebe7a25fa338
Created June 1, 2016 07:37
UILongPressGestureRecognizer
UILongPressGestureRecognizer *longPress = [[UILongPressGestureRecognizer alloc]
initWithTarget:self
action:@selector(handleLongPress:)];
longPress.minimumPressDuration = 1.0;
[myView addGestureRecognizer:longPress];
[longPress release];
- (void)handleLongPress:(UILongPressGestureRecognizer *)gesture {
if(UIGestureRecognizerStateBegan == gesture.state) {
@hqlulu
hqlulu / gist:8a67df8bf809b93e8b28cb3d80a77478
Created May 31, 2016 07:01
uitableview display no data tips
UILabel *tips = [[UILabel alloc] init];
tips.numberOfLines = 0;
tips.textAlignment = NSTextAlignmentCenter;
tips.textColor = [UIColor lightGrayColor];
tips.text = @"No Data.";
self.tableView.backgroundView = tips;
CLLocationCoordinate2D coor = ctrpoint;//原始坐标
NSDictionary* testdic = BMKConvertBaiduCoorFrom(coor,BMK_COORDTYPE_GPS);
//NSLog(@"x=%@,y=%@",[testdic objectForKey:@"x"],[testdic objectForKey:@"y"]);
//解密加密后的坐标字典
CLLocationCoordinate2D baiduCoor = BMKCoorDictionaryDecode(testdic);//转换后的百度坐标
[UIView animateWithDuration:.25
animations:^{
self.btnAdd.frame = hideFrame;
self.btnEnd.frame = hideFrame;
}
completion:^(BOOL finished){
self.btnAdd.hidden = YES;
self.btnEnd.hidden = YES;
self.startLabel.text = @"";
[UIView animateWithDuration:.4