Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@ws
Created June 9, 2017 02:06
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 ws/efdcdc002a95e5bf393463c5b9d0f782 to your computer and use it in GitHub Desktop.
Save ws/efdcdc002a95e5bf393463c5b9d0f782 to your computer and use it in GitHub Desktop.
Find a random Facebook event (to bring yourself out of your comfort zone)
// Inspired by http://www.npr.org/sections/alltechconsidered/2017/06/08/531796329/eager-to-burst-his-own-bubble-a-techie-made-apps-to-randomize-his-life
// Literally all of the heavy lifting is done by https://github.com/tobilg/facebook-events-by-location-core
var EventSearch = require('facebook-events-by-location-core')
var es = new EventSearch({
"lat": 42.338998, // http://www.latlong.net/
"lng": -83.048520,
"distance": 250,
"accessToken": "YOURTOKENHERE" // https://developers.facebook.com/tools/accesstoken
})
es.search().then((response) => {
var events = response.events
var event = events[Math.floor(Math.random()*events.length)]
console.log(event)
}).catch(function (error) {
console.error(JSON.stringify(error));
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment