Skip to content

Instantly share code, notes, and snippets.

@afian
afian / routeMap.html
Created September 21, 2023 10:28
ODRD / Routes Preferred ComputeRoutes example
View routeMap.html
<!DOCTYPE html>
<html>
<head>
<title>Draw Route</title>
<script src="https://maps.googleapis.com/maps/api/js?key=GOOGLE_API_KEY&v=3.exp&libraries=geometry&callback=Function.prototype"></script>
</head>
<body>
<div id="map" style="height: 600px; width: 100%;"></div>
<script>
@afian
afian / gist:74b37108a5083e064891791725d144e2
Created July 3, 2023 03:47
Google Directions API response
View gist:74b37108a5083e064891791725d144e2
{
"geocoded_waypoints" : [
{
"geocoder_status" : "OK",
"place_id" : "ChIJyconjF9xhlQRC27qDW4xEj0",
"types" : [ "street_address" ]
},
{
"geocoder_status" : "OK",
"place_id" : "ChIJWSwFlCdyhlQRO7TzPAjWNds",
@afian
afian / shopify-draggable-example.html
Created May 27, 2023 06:27
Shopify Draggable example code
View shopify-draggable-example.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<style>
.horizontal-menu {
list-style-type: none;
margin: 0;
padding: 0;
@afian
afian / routific_vrp-long_api.js
Created December 17, 2018 22:30
Asynchronous Routific VRP call
View routific_vrp-long_api.js
function vrpLongCall() {
var params = {
visits: {
visit_1: {
location: {
name: "Jack Smith",
lat: 49.227607,
lng: -123.1363085
},
start: "8:00",
@afian
afian / routific_vrp_api_call.js
Created December 17, 2018 22:29
Synchronous Routific API call
View routific_vrp_api_call.js
var params = {
visits: {
visit_1: {
location: {
name: "Jack Smith",
lat: 49.227607,
lng: -123.1363085
},
start: "8:00",
end: "16:00",
@afian
afian / fix_vrp.json
Created September 7, 2018 22:15
Make a POST request to http://api.routific.com/v1/fix
View fix_vrp.json
{
"visits": {
"order_1": {
"location": {
"name": "6800 Cambie",
"lat": 49.227107,
"lng": -123.1163085
},
"start": "9:00",
View pdp_fix.json
{
"visits": {
"5014": {
"dropoff": {
"location": {
"name": "Whole Food Market",
"lat": 51.5621878348459,
"lng": -0.074848409476045
},
View vrp_fix.json
{
"visits": {
"order_1": {
"location": {
"name": "6800 Cambie",
"lat": 49.227107,
"lng": -123.1163085
},
"start": "9:00",
@afian
afian / routific_predicted_traffic.json
Created June 22, 2018 05:49
User predicted traffic on a /vrp-long call
View routific_predicted_traffic.json
{
"visits": {
"order_1": {
"location": {
"name": "1653 W Congress Pkwy, Chicago, IL",
"lat": 41.874643,
"lng": -87.669154
},
"start": "12:00",
"end": "14:00",
@afian
afian / address_no_lat_lng_demo.json
Last active July 15, 2018 16:11
Make a POST request to http://api.routific.com/v1/vrp-long w/o using lat/lng in location object
View address_no_lat_lng_demo.json
{
"visits": {
"order_1": {
"location": {
"address": "555 W Hastings Street, Vancouver, BC V6B 4N6"
},
"start": "12:00",
"end": "14:00",
"duration": 10
}