Skip to content

Instantly share code, notes, and snippets.

/*
* Copyright (c) 2010 Tobias Schneider
* This script is freely distributable under the terms of the MIT license.
*/
(function(){
var UPC_SET = {
"3211": '0',
"2221": '1',
"2122": '2',
@gorelog
gorelog / navigator.geolocation.getAccuratePosition
Created December 6, 2011 01:38 — forked from apinstein/navigator.geolocation.getAccuratePosition
navigator.geolocation.getAccuratePosition
// Sligntly modified to return the best position out of those generated. The original script (https://gist.github.com/510278/)
// only returned the last one. tmpAccuracy was added to check against the current position and set the bestPosition if indeed it is the best.
//
// navigator.geolocation.getAccuratePosition() is an improved version of navigator.geolocation.getCurrentPosition()
//
// getAccuratePosition() is designed and tested for iOS.
//
// The problem with getCurrentPosition() is that it returns an inaccurate position even with "enableHighAccuracy" enabled.
// The problem with watchPosition() is that it calls the success handler every second, and it is resource-intensive.
//