Skip to content

Instantly share code, notes, and snippets.

@nysalor
Created January 15, 2012 08:41
Show Gist options
  • Save nysalor/1615095 to your computer and use it in GitHub Desktop.
Save nysalor/1615095 to your computer and use it in GitHub Desktop.
gmaps4rails:getposition and replace markers
@get_current_position = () =>
navigator.geolocation.getCurrentPosition @nearby_places, @failed_alert
@nearby_places = (position) =>
res = $.getJSON "/places/nearby.json", { lat: position.coords.latitude, long: position.coords.longitude },
(json) ->
Gmaps.map.replaceMarkers json
@failed_alert = () =>
alert "failed to get current position."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment