1.0.3 • Published 7 years ago

alivefyi v1.0.3

Weekly downloads
4
License
MIT
Repository
github
Last release
7 years ago

alivefyi

(Ah-live-ify) v. To collectively solve problems using a network of live data channels as a feedback loop.

This repo serves as example of using a live data network to build an extremely powerful feedback loop to solve all kinds of problems.

The channels preconfigured in Alivefyi will specifically attempt to solve the problem of what to do, where to eat, what to see, entertain your friends and family and otherwise interact with the present.

It uses static data and information about your location and desire to generate live data that is relevant to your present.

It not only attempts to solve boredom, but it allows the community to collectively access and benefit from it.

npm i alivefyi --save

users

providers

Try it on runkit

  1. First Create a provider to respond to the client messages.
  2. Next Create a client and generate a message.
  3. That's it! You have Live Data!

Create a request:

const alivefyi = require('alivefyi');
alivefyi.ask({
  // any terms to look for
  terms: 'Machine Zone'
});
alivefyi.listen(data => update(data));

/**
* updates the console
* @param one of many data responses from one or more providers
*/
function update(data) {
  console.log('New data', data);
}

Create a feed:

const alivefyi = require('alivefyi');

/**
* listen for user inputs
*/
alivefyi.subscribe((data) => {
  console.log('received', data);
  if(data.terms.indexOf('Machine Zone')) {
    publishAddress();
  }
});

/**
* publish to data to user
*/
function publishAddress() {
  alivefyi.publish(result);
}

function getGoogleUrl(location) {
  const info = `${location.address.streetAddress},+${location.address.addressLocality},+${location.address.addressRegion}+${location.address.postalCode}/@${location.geo.latitude},${location.geo.longitude}`;
  const result = info.replace('+', '%2B').replace(/\s/gm, '+');
  return `https://www.google.com/maps/place/${result}`;
}

const ADDRESS = {
  "@type": "Place",
  _pid: 'Test',
  name: `Machine Zone`,
  description: ``,
  address: {
    "@type": "PostalAddress",
    streetAddress: '1050 County Hwy G3',
    addressLocality: 'Palo Alto',
    addressRegion: 'CA',
    postalCode: '94304',
    addressCounty: 'US',
  },
  geo: {
    "@type": "GeoCoordinates",
    "latitude": 37.4191419,
    "longitude": -122.1465053,
  },
  data: {
    coupons: [],
  }
}
ADDRESS.url = getGoogleUrl(ADDRESS);
1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago