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
+ (UIColor *) colorFromHexString:(NSString *)hexString { | |
NSString *cleanString = [hexString stringByReplacingOccurrencesOfString:@"#" withString:@""]; | |
if([cleanString length] == 3) { | |
cleanString = [NSString stringWithFormat:@"%@%@%@%@%@%@", | |
[cleanString substringWithRange:NSMakeRange(0, 1)],[cleanString substringWithRange:NSMakeRange(0, 1)], | |
[cleanString substringWithRange:NSMakeRange(1, 1)],[cleanString substringWithRange:NSMakeRange(1, 1)], | |
[cleanString substringWithRange:NSMakeRange(2, 1)],[cleanString substringWithRange:NSMakeRange(2, 1)]]; | |
} | |
if([cleanString length] == 6) { | |
cleanString = [cleanString stringByAppendingString:@"ff"]; |
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
SELECT *, (3959 * acos(cos(radians('".$lat."')) * cos(radians(lat)) * cos( radians(long) - radians('".$lng."')) + sin(radians('".$lat."')) * | |
sin(radians(lat)))) | |
AS distance | |
FROM carpark WHERE distance < 15 ORDER BY distance LIMIT 0 , 10 |
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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
for i in *.avi; do name=`echo $i | cut -d'.' -f1`; echo $name; ffmpeg -i $i $name.mp4 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
// Dump an entire database | |
mysqldump --opt -u [uname] -p[pass] [dbname] > [backupfile.sql] | |
// Dump specific tables from a database | |
mysqldump -u root -p [dbname] [table1] [table2] > [backupfile.sql] | |
// Restore database from sql file | |
mysql -u [uname] -p[pass] [db_to_restore] < [backupfile.sql] |
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
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath | |
{ | |
static UITableViewCell *cell; | |
if (cell == nil) { | |
cell = [tableView dequeueReusableCellWithIdentifier:@"ClueCell"]; | |
} | |
[self configureCell:cell forIndexPath:indexPath]; | |
return [cell.contentView systemLayoutSizeFittingSize:UILayoutFittingCompressedSize].height + 1.0f; |
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)zoomToFitMapAnnotations:(MKMapView*)mapView | |
{ | |
if([mapView.annotations count] == 0) | |
return; | |
CLLocationCoordinate2D topLeftCoord; | |
topLeftCoord.latitude = -90; | |
topLeftCoord.longitude = 180; | |
CLLocationCoordinate2D bottomRightCoord; |
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
stop_id,stop_name,stop_lat,stop_lon,location_type | |
175,ROSEMONT SUPERSTOP, 28.6085340000, -81.4282110000,0 | |
178,SPRINGS VILLAGE SHOPPING CTR, 28.6882790000, -81.4065090000,0 | |
214,KOA ST AND MONTEREY RD, 28.1566130000, -81.4820430000,0 | |
553,1700 17TH ST AND CONNECTICUT AVE, 28.2424240000, -81.2879670000,0 | |
554,4500 US 192 HWY AND COMMERCE CENTER DR, 28.2548600000, -81.3190380000,0 | |
555,ST CLOUD WAL-MART, 28.2541690000, -81.3148810000,0 | |
556,4200 US 192 HWY AND KISSIMMEE PARK RD, 28.2508540000, -81.3130770000,0 | |
561,2700 10TH ST AND LOUISIANA AVE, 28.2488240000, -81.2993230000,0 | |
562,2400 10TH ST AND TENNESSEE AVE, 28.2488950000, -81.2964650000,0 |
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
UIUserNotificationType userNotificationTypes = (UIUserNotificationTypeAlert | | |
UIUserNotificationTypeBadge | | |
UIUserNotificationTypeSound); | |
UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:userNotificationTypes | |
categories:nil]; | |
if ([application respondsToSelector:@selector(registerUserNotificationSettings:)]) { | |
[application registerUserNotificationSettings:settings]; | |
[application registerForRemoteNotifications]; | |
} else { |
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
$weeks = array(); | |
$index = 0; | |
while (count($tmp_logs) > 0) { | |
$log = array_shift($tmp_logs); | |
$date = $log['date']; | |
$sunday = strtotime('last Sunday', $date); | |
$saturday = strtotime('Saturday 11:59pm', $date); | |
$done = false; |
OlderNewer