#Generate cities data
wget http://download.geonames.org/export/dump/cities15000.zipunzip cities15000.zipnode geonames.js cities15000.txt
The result is json array of cities in the following format:
{
_id:
#Generate cities data
wget http://download.geonames.org/export/dump/cities15000.zipunzip cities15000.zipnode geonames.js cities15000.txtThe result is json array of cities in the following format:
{
_id:
| //set environment variable | |
| heroku config:set API_URL='<URL HERE>' --app <APP NAME> | |
| //Database dump | |
| heroku pgbackups:capture | |
| curl -o latest.dump `heroku pgbackups:url` | |
| //Restore locally | |
| pg_restore --verbose --clean --no-acl --no-owner -h localhost -U myuser -d mydb latest.dump |
| //ios6 | |
| SString *UUID = [[NSUUID UUID] UUIDString]; | |
| //ios5 | |
| - (BOOL)application:(UIApplication *)application | |
| didFinishLaunchingWithOptions:(NSDictionary *)launchOptions | |
| { | |
| NSString *UUID = [[NSUserDefaults standardUserDefaults] objectForKey:kApplicationUUIDKey]; |
| typedef enum: NSInteger { | |
| NSOperationQueuePriorityNormal = 0; | |
| NSOperationQueuePriorityHigh = 4; | |
| } NSOperationQueuePriority; |
| -(void)AppendExisting:(NSString*)val | |
| { | |
| @synchronized (val) { | |
| [oldValue stringByAppendingFormat:@"-%@",val]; | |
| } | |
| } |
| #define DATA(str) [(NSString*)(str) dataUsingEncoding:NSUTF8StringEncoding] | |
| - (NSData *)generateFormData:(NSDictionary *)dictionary boundary:(NSString *)boundary { | |
| NSMutableData *data = [[NSMutableData alloc] init]; | |
| id key; | |
| NSEnumerator *enumerator = [dictionary keyEnumerator]; | |
| while (key = [enumerator nextObject]) { | |
| id value = [dictionary valueForKey:key]; | |
| [data appendData:DATA(([NSString stringWithFormat:@"--%@\r\n", boundary]))]; |
| - (void) viewDidAppear:(BOOL)animated { | |
| [super viewDidAppear:animated]; | |
| [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(orientationChanged:) name:@"UIDeviceOrientationDidChangeNotification" object: nil]; | |
| } | |
| -(void)viewDidDisappear:(BOOL)animated { | |
| [super viewDidDisappear:animated]; | |
| [[NSNotificationCenter defaultCenter] removeObserver:self name:@"UIDeviceOrientationDidChangeNotification" object:nil]; | |
| } |
| // | |
| // UIWebView+TrueHeight.h | |
| // RAWebViewTrueHeight | |
| // | |
| // Created by Stephen Keep on 08/03/2013. | |
| // Copyright (c) 2013 Stephen Keep. All rights reserved. | |
| // | |
| #import <Foundation/Foundation.h> |