Skip to content

Instantly share code, notes, and snippets.

@daguar
Last active August 29, 2015 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save daguar/9742426 to your computer and use it in GitHub Desktop.
Save daguar/9742426 to your computer and use it in GitHub Desktop.
An approach for "is it cash only?"

Super-minimal version approach:

  1. On page load, get the location of the user (latitude + longitude) using HTML5 geolocation. This is done using Javascript, as in this example: http://www.w3schools.com/html/html5_geolocation.asp

  2. Show user a simple form with just a text box and button ("Search"). Then, the user enters the name of the restaurant they're looking for into the box and clicks the button.

  3. The form submits the user's text as well as the latitude/longitude from step 1 (as hidden fields in a POST request), this goes to a URL you've coded on the backend.

  4. On the backend, the web app feeds the text and lat/long into a Yelp API search ( http://www.yelp.com/developers/documentation/v2/search_api#searchGC ) and then grabs the first result, and shows it to the user with whether "accepts credit cards" is true or false [see note below.]

  • Note: While Yelp shows "credit cards accepted" on the web site, it's unclear whether that particular data item is available through the API. I'd try out an API call using their examples first to see whether it does. If it doesn't, you could potentially cheat and do a full web request to the web site (though it's not totally kosher.)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment