{"id":18624812,"url":"https://github.com/gabrieldarezzo/who-next","last_synced_at":"2025-11-03T19:30:30.874Z","repository":{"id":51748914,"uuid":"203065451","full_name":"gabrieldarezzo/who-next","owner":"gabrieldarezzo","description":"Pegue sua localização, e encontre as pessoas próximas (Formula de Haversine)","archived":false,"fork":false,"pushed_at":"2022-12-30T18:26:39.000Z","size":219,"stargazers_count":0,"open_issues_count":3,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-12-27T05:41:58.450Z","etag":null,"topics":["google-maps-api","googlemaps","haversine","sample","sql"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gabrieldarezzo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-08-18T23:06:38.000Z","updated_at":"2020-03-12T16:45:02.000Z","dependencies_parsed_at":"2023-01-31T13:00:38.978Z","dependency_job_id":null,"html_url":"https://github.com/gabrieldarezzo/who-next","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gabrieldarezzo%2Fwho-next","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gabrieldarezzo%2Fwho-next/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gabrieldarezzo%2Fwho-next/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gabrieldarezzo%2Fwho-next/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gabrieldarezzo","download_url":"https://codeload.github.com/gabrieldarezzo/who-next/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239418578,"owners_count":19635208,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["google-maps-api","googlemaps","haversine","sample","sql"],"created_at":"2024-11-07T04:31:08.647Z","updated_at":"2025-11-03T19:30:30.844Z","avatar_url":"https://github.com/gabrieldarezzo.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# who-next\nAPI em JS para informar quem está proximo de você em REAL-TIME\nAPI in JS get nearbly users\n\n![Scheme](docs/mapa_proximos.png)\n\n```js\n0 ~ 1 KM  == VERDE\n2 ~ 3 KM  == AMARELO\n\u003e3 KM  == VERMELHO\n```\n\n```js\nlet users = [\n    {\n        id: 1,\n        name: 'João',\n        // Google Maps\n        lat  : -23.9789580,\n        lng  : -46.3121512,\n    }, \n    {\n        id: 2,\n        name: 'Vitor',        \n        lat  : -23.9772151,\n        lng  : -46.3082780,\n    }, \n    {\n        id: 3,\n        name: 'Murillo',        \n        lat  : -23.9581367,\n        lng  : -46.3925527,\n    },\n    {\n        id: 4,\n        name: 'DEXTERpy',        \n        lat  : -23.9614568,\n        lng  : -46.3247244,\n    },\n    {\n        id: 5,\n        name: 'Celso',        \n        lat  : -23.9739162,\n        lng  : -46.3122721,\n    },\n    {\n        id: 6,\n        name: 'Darezzo',\n        lat  :-23.9366827,\n        lng  :-46.3882702,\n    },\n];\n```  \n\n\n\n\n\n\n\nFórmula matemática de [Haversine](https://pt.wikipedia.org/wiki/F%C3%B3rmula_de_Haversine) (esfera da terra)\n\n\n\n```sql\ncreate database imasters;\n\nuse imasters;\n\nCREATE TABLE pessoa (\n\t id int(8) auto_increment primary key\n\t,nome  varchar(50)\n\t,lat float(9,6) NOT NULL\n\t,lng float(9,6) NOT NULL\n);\n\nINSERT INTO pessoa (nome, lat, lng) VALUE \n('Vit', -23.9789580, -46.3121512)\n,('Rafa', -23.9772151, -46.3082780)\n,('João', -23.9581367, -46.3925527)\n,('Rodrigo', -23.9366827, -46.3882702)\n,('Celso', -23.9739162, -46.3122721)\n,('allex', -23.9614568, -46.3247244);\n\n/*\n-- Rafa\n-23.9772151\n-46.3082780\n*/\n\nSELECT\n (((acos(sin((-23.9772151*pi()/180)) * sin((`lat`*pi()/180))+cos((-23.9772151*pi()/180))  * cos((`lat`*pi()/180)) * cos(((-46.3082780- `lng`)*pi()/180))))*180/pi())*60*1.1515*1.609344) as distance\n,nome\nFROM pessoa\nWHERE distance \u003c= 10 -- KM\norder by distance\n;\n\n/*\n-- Result: \n \n+------------------------+---------+\n| distance               | nome    |\n+------------------------+---------+\n| 0.00013425232662457948 | Rafa    |\n|    0.43878413150349677 | Vit     |\n|     0.5470051287699728 | Celso   |\n|     2.4210902068465825 | allex   |\n|      8.821210177019271 | João    |\n|       9.29394275935523 | Rodrigo |\n+------------------------+---------+\n6 rows in set (0.00 sec)\n\n*/\n```` \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgabrieldarezzo%2Fwho-next","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgabrieldarezzo%2Fwho-next","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgabrieldarezzo%2Fwho-next/lists"}