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
| from lxml import etree | |
| OSM_API_URL = "http://api.openstreetmap.org/api/0.6/map?bbox=%s" | |
| def get_streets(bbox): | |
| """ | |
| Makes an OSM API request and parses the streets and their waypoints in the | |
| XML response, returns a list |
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
| // Issue: IE doesn't support Array.indexOf (!) | |
| // Solution: Use this | |
| if (!Array.indexOf){ | |
| Array.prototype.indexOf = function(obj) { | |
| for (var i = 0; i < this.length; i++) { | |
| if (this[i] == obj) { | |
| return i; | |
| } | |
| } |
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 /Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/PrivatePlugIns/ | |
| sudo ln -s /Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/Plug-ins/GCC\ 4.2\ \(Plausible\ Blocks\ -\ iPhoneOS\).xcplugin | |
| cd /Developer/Library/Xcode/PrivatePlugIns/Xcode3Core.ideplugin/Contents/SharedSupport/Developer/Library/Xcode/Plug-ins/ | |
| sudo ln -s /Developer/Library/Xcode/Plug-ins/GCC\ 4.2\ \(Plausible\ Blocks\).xcplugin |
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
| NSString *trimmedTitle = [self.entryTitle stringByReplacingOccurrencesOfString:@"The Best" | |
| withString:@"" | |
| options:NSCaseInsensitiveSearch | |
| range:NSMakeRange(0, [self.entryTitle length])]; | |
| trimmedTitle = [trimmedTitle stringByReplacingOccurrencesOfString:@"in Toronto" | |
| withString:@"" | |
| options:NSCaseInsensitiveSearch | |
| range:NSMakeRange(0, [trimmedTitle length])]; | |
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
| RASTERIZE_COLOR_FIELD = "__color__" | |
| RASTERIZE_COLOR = (158, 18, 110, 200) | |
| pixel_size = 0.05 | |
| # Open the data source | |
| orig_data_source = ogr.Open(args[0]) | |
| # Make a copy of the layer's data source because we'll need to |
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
| ZBarReaderViewController *controller = [ZBarReaderViewController new]; | |
| [controller setReaderDelegate:self]; | |
| [controller.scanner setSymbology:ZBAR_I25 config:ZBAR_CFG_ENABLE to:0]; | |
| UIView *overlayView = [[UIView alloc] initWithFrame:CGRectMake(0.0, 0.0, self.view.frame.size.width, 80.0)]; | |
| UILabel *helpLabel = [[UILabel alloc] initWithFrame:CGRectInset(overlayView.bounds, 15.0, 10.0)]; | |
| [helpLabel setFont:[UIFont boldSystemFontOfSize:14.0]]; | |
| [helpLabel setTextColor:[UIColor whiteColor]]; |
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
| #pragma mark - Scroll View Delegate | |
| - (void)scrollViewDidScroll:(UIScrollView *)scrollView { | |
| [super scrollViewDidScroll:scrollView]; | |
| if (_refreshInProgress) return; | |
| if (self.tableView.contentOffset.y > 50.0 && self.tableView.contentOffset.y < 140.0) { | |
| if (self.tableView.contentOffset.y <= 90.0) { | |
| [(RefreshView *)self.tableView.tableHeaderView displayInstructions]; |
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
| static NSInteger compareListingTypesAccordingToStaticOrder(ListingType *type1, ListingType *type2, void *context) { | |
| static NSArray *orderedTypes = nil; | |
| if (orderedTypes == nil) { | |
| orderedTypes = [[NSArray alloc] initWithObjects: | |
| @"Everything", @"Restaurants", @"Bars", | |
| @"Cafes", @"Bakeries", @"Fashion Stores", | |
| @"Design Stores", @"Bookstores", @"Art Galleries", | |
| @"Fitness Clubs", @"Grocery", @"Hotels", @"Services", nil]; | |
| } |
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
| #include <sys/xattr.h> | |
| - (NSInteger)markFilesInDirectoryAsDoNotBackup:(NSString *)path { | |
| NSFileManager *fileManager = [NSFileManager defaultManager]; | |
| NSDirectoryEnumerator *directoryEnumerator = [fileManager enumeratorAtPath:path]; | |
| NSString *filePath = nil; | |
| NSInteger count = 0; | |
| const char *attrName = "com.apple.MobileBackup"; | |
| u_int8_t attrValue = 1; |
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
| import hashlib, hmac, mimetypes, os, time | |
| from base64 import b64encode, b64decode | |
| from calendar import timegm | |
| from datetime import datetime | |
| from email.utils import formatdate | |
| from urllib import quote | |
| from tornado.gen import coroutine, Return | |
| from tornado.httpclient import AsyncHTTPClient, HTTPError |
OlderNewer