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
<div id="log"></div> | |
<script type="text/javascript" src="https://dl.dropboxusercontent.com/sh/oexkzj4z2zzs02d/AADB02b-GUnvoxDr9EvD61yZa/adyen.encrypt.nodom.min.js"></script> | |
<script src="https://js.braintreegateway.com/js/braintree-2.22.2.min.js"></script> | |
<script type="text/javascript" src="https://js.stripe.com/v2/"></script> | |
<script type="text/javascript"> | |
(function() { | |
//Copy your public keys here | |
var stripePK = "pk_test_jg6c4WIhuzDD7kcYW0Nu7T6r"; | |
var adyenPK = "10001|B01FDAF7CD9B73F094906C5B078963FAAE57AFC619D561EFC784EA505EC6CCA94AF0CA3F97CA9CFC04E2151F39A461BF45DE7CB7DEA46C56EB3420502DA69BF4A6FFA21464D46861051367A26422EF3A9E6288F821CB47E8F88B4C2D9BEEF96AF0686E6F1C4171C5B5BD1C80E23A112BE57B990389E783B8F614F07CDBBBB68D7175F0282C7E0FA985D881E2A9EB6B54BE231D5733912A217F92D5952C6AA1ECF1765F11337441502FFCDD9B9DD3F2A40F98E96DDF51E60B06D8987D3622EB119AF7360055626DC99E6555724FBBFC1F985DB506E16E6A9B040959799C3C6ADD7F21C97493D7823CE7A234491377165815CE075ED55375F772F101DA0335D70D"; | |
var brainTreePK |
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 | |
pickup_polyId, | |
SUM(fare_amount)/COUNT(*) AS average_fare, | |
COUNT(*) AS no_of_trips | |
FROM | |
[nyctaximap:dataflow.nyc_output_join_fare_distinct] | |
WHERE | |
fare_amount!=0 | |
GROUP BY | |
pickup_polyId |
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 | |
pickup_polyId, | |
COUNT(*) AS no_of_trips | |
FROM | |
[nyctaximap:dataflow.nyc_output_join_fare_distinct] | |
GROUP BY | |
pickup_polyId | |
ORDER BY | |
no_of_trips DESC; |
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 | |
pickup_polyId, | |
SUM(fare_amount)/COUNT(*) AS average_fare, | |
COUNT(*) AS no_of_trips | |
FROM | |
[nyctaximap:dataflow.nyc_output_join_fare_distinct] | |
WHERE | |
fare_amount!=0 | |
GROUP BY | |
pickup_polyId |
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 | |
pickup_polyId, | |
SUM(tip_amount)/COUNT(*) AS average_tip, | |
COUNT(*) AS no_of_trips | |
FROM | |
[nyctaximap:dataflow.nyc_output_join_fare_distinct] | |
WHERE | |
tip_amount!=0 | |
GROUP BY | |
pickup_polyId |
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
@ApiMethod(name = "point", httpMethod = "get", path = "point") | |
public ArrayList < MyFence > queryPoint(@Named("group") String group, @Named("lng") double lng, @Named("lat") double lat) { | |
ArrayList < MyFence > fences = new ArrayList < MyFence > (); | |
//Get the Index from Memcache. | |
MemcacheService syncCache = MemcacheServiceFactory.getMemcacheService(); | |
GeometryFactory gf = new GeometryFactory(); | |
STRtree index = (STRtree) syncCache.get(group); // read from cache | |
if (index != null) { | |
Coordinate coord = new Coordinate(lng, lat); |
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
@ApiMethod(name = "polyline", httpMethod = "post", path = "polyline") | |
public ArrayList < MyFence > queryPolyLine(@Named("group") String group, MyPolyLine polyline) { | |
ArrayList < MyFence > fences = new ArrayList < MyFence > (); | |
//Get the index from Memcache. | |
MemcacheService syncCache = MemcacheServiceFactory.getMemcacheService(); | |
GeometryFactory gf = new GeometryFactory(); | |
STRtree index = (STRtree) syncCache.get(group); // read from cache | |
if (index != null) { | |
//Create coordinate array. |
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
@ApiMethod(name = "polygon", httpMethod = "post", path = "polygon") | |
public ArrayList < MyFence > queryPolygon(@Named("group") String group, MyPolyLine polyline) { | |
ArrayList < MyFence > fences = new ArrayList < MyFence > (); | |
//Get index from Memcache | |
MemcacheService syncCache = MemcacheServiceFactory.getMemcacheService(); | |
STRtree index = (STRtree) syncCache.get(group); // read from cache | |
if (index != null) { | |
//Create coordinate array. | |
double[][] points = polyline.getCoordinates(); |
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
@ApiMethod(name = "list", httpMethod = "get", path = "list") | |
public ArrayList < MyFence > listFences(@Named("group") String group) { | |
ArrayList < MyFence > fences = new ArrayList < MyFence > (); | |
DatastoreService datastore = DatastoreServiceFactory.getDatastoreService(); | |
Key fenceKey = KeyFactory.createKey("Geofence", group); | |
Query query = new Query("Fence", fenceKey).addSort("id", Query.SortDirection.DESCENDING); | |
List < Entity > fencesFromStore = datastore.prepare(query).asList(FetchOptions.Builder.withDefaults()); | |
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
@ApiMethod(name = "getById", httpMethod = "get", path = "getById") | |
public ArrayList < MyFence > getFenceById(@Named("group") String group, @Named("id") long id) { | |
DatastoreService datastore = DatastoreServiceFactory.getDatastoreService(); | |
Key fenceKey = KeyFactory.createKey("Geofence", group); | |
Filter propertyFilter = new FilterPredicate("id", FilterOperator.EQUAL, id); | |
Query query = new Query("Fence", fenceKey).setFilter(propertyFilter); | |
Entity fenceFromStore = datastore.prepare(query).asSingleEntity(); | |
ArrayList < MyFence > fences = new ArrayList < MyFence > (); | |
if (fenceFromStore != null) { |