Skip to content

Instantly share code, notes, and snippets.

View twoism's full-sized avatar
🖖

Christopher Burnett twoism

🖖
  • /dev/null
  • New York, NY
View GitHub Profile
NSString *destinationString = [NSString stringWithFormat:@"%f,%f",appDelegate.geoEngine.manager.location.coordinate.latitude,appDelegate.geoEngine.manager.location.coordinate.longitude];
// This is the URL that had been in the app since the feature was added
- NSString *url = [NSString stringWithFormat: @"http://maps.google.com/maps?saddr=%@&daddr=%f,%f",destinationString, self.pointOfInterest.coordinate.latitude, self.pointOfInterest.coordinate.longitude];
// This is what I replaced it with
+ NSString *poiString = [NSString stringWithFormat:@"%@ %@ %@, %@", self.pointOfInterest.title, self.pointOfInterest.address, self.pointOfInterest.city, self.pointOfInterest.state];
+
+
+ NSString *url = [NSString stringWithFormat: @"http://maps.google.com/maps?saddr=%@&daddr=%@",destinationString, poiString];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:[url stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding]]];
commit 61ec9dec569736fcdf6ce559a1f67f2f95c9eae5
Author: Christopher Burnett <chris.burnett@digitalscientists.com>
Date: Thu Oct 29 15:46:11 2009 -0400
added name and address to directions when opening maps.app
diff --git a/Classes/PointOfInterestDetail.m b/Classes/PointOfInterestDetail.m
index 108dc2e..a432f13 100644
--- a/Classes/PointOfInterestDetail.m
+++ b/Classes/PointOfInterestDetail.m
CLLocationCoordinate2D myHouse;
myHouse.latitude = 33.760174;
myHouse.longitude = -84.332780;
CLLocationCoordinate2D cornerTavern;
cornerTavern.latitude = 33.679771;
cornerTavern.longitude = -84.440544;
[GDirection getDirectionsFromLocation:myHouse toLocation:cornerTavern withDelegate:self];
// Local Search
CLLocationCoordinate2D myHouse;
myHouse.latitude = 33.760174;
myHouse.longitude = -84.332780;
[GLocation getLocalResultsForLocation:myHouse withQuery:@"Corner Tavern" withDelegate:self];
// Directions
CLLocationCoordinate2D myHouse;
InterstateExit Load (19.3ms) SELECT *, (ACOS(least(1,COS(0.651560888380549)*COS(-2.12983804456551)*COS(RADIANS(interstate_exits.lat))*COS(RADIANS(interstate_exits.lng))+
COS(0.651560888380549)*SIN(-2.12983804456551)*COS(RADIANS(interstate_exits.lat))*SIN(RADIANS(interstate_exits.lng))+
SIN(0.651560888380549)*SIN(RADIANS(interstate_exits.lat))))*3963.19)
AS distance FROM `interstate_exits` WHERE ((interstate = 'I-280') AND ((interstate_exits.lat<37.331689))) ORDER BY distance ASC LIMIT 1
InterstateExit Load (36.3ms) SELECT *, (ACOS(least(1,COS(0.651560888380549)*COS(-2.12983804456551)*COS(RADIANS(interstate_exits.lat))*COS(RADIANS(interstate_exits.lng))+
COS(0.651560888380549)*SIN(-2.12983804456551)*COS(RADIANS(interstate_exits.lat))*SIN(RADIANS(interstate_exits.lng))+
SIN(0.651560888380549)*SIN(RADIANS(interstate_exits.lat))))*3963.19)
AS distance FROM `interstate_exits` WHERE (((interstate_exits.lat>37.331689))) ORDER BY distance ASC LIMIT 1
InterstateExit Load (24.4ms) SELECT *, (ACOS(leas
@twoism
twoism / gist:224227
Created November 2, 2009 15:38
1000 Requests 10 users
Server Software: Apache/2.2.8
Server Hostname: staging.bestexitapp.com
Server Port: 80
Document Path: /upcoming.plist
Document Length: 40262 bytes
Concurrency Level: 10
Time taken for tests: 70.790 seconds
Complete requests: 1000
Server Software: Apache/2.2.8
Server Hostname: staging.bestexitapp.com
Server Port: 80
Document Path: /upcoming.plist
Document Length: 36639 bytes
Concurrency Level: 10
Time taken for tests: 28.947 seconds
Complete requests: 1000
# this both the most awesome and stupid thing I
# have ever written
def self.wacky_resort items,course,interstate
if interstate % 2 == 0
ascending = (course >= 90 && course <= 270)
else
ascending = (course >= 0 && course <= 180)
end
items = ascending ? items.sort_by{|i| i[:interstate_exit]} : items.sort_by{|i| i[:interstate_exit]}.reverse
end
Benchmark.bm do|b|
b.report("create") do
10_000.times do |x|
User.create(:username=>"Foo #{x}")
end
end
end
Results:
require 'test_helper'
class Project
include MongoMapper::Document
key :name, String
key :context_id, String
many :tasks
many :collaborators
end