Skip to content

Instantly share code, notes, and snippets.

@jonathanKingston
Created April 30, 2012 14:33

Revisions

  1. jonathanKingston revised this gist Apr 30, 2012. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,6 @@
    Meteor.setInterval(function() {

    var allTheThings = Things.find({});
    //Near will contain all the object _id's and this will be an array of all other objects nearby.
    near = {}
    allTheThings.forEach(function (thing) {
    if (thing != undefined) {
  2. jonathanKingston revised this gist Apr 30, 2012. 1 changed file with 14 additions and 17 deletions.
    31 changes: 14 additions & 17 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -1,20 +1,17 @@
    Meteor.setInterval(function() {

    var allTheThings = Things.find({});
    near = {}
    allTheThings.forEach(function (thing) {

    if (thing != undefined) {
    near[thing._id] = [];
    allTheThings.forEach(function (thing2) {
    if(thing2.x >= thing.x-5 && thing2.x <= thing.x+5) {
    if(thing2.y >= thing.y-5 && thing2.y <= thing.y+5) {
    near[thing._id].push thing2;
    }
    }
    });

    }
    }

    var allTheThings = Things.find({});
    near = {}
    allTheThings.forEach(function (thing) {
    if (thing != undefined) {
    near[thing._id] = [];
    allTheThings.forEach(function (thing2) {
    if(thing2.x >= thing.x-5 && thing2.x <= thing.x+5) {
    if(thing2.y >= thing.y-5 && thing2.y <= thing.y+5) {
    near[thing._id].push thing2;
    }
    }
    });
    }
    }
    },5000);
  3. jonathanKingston revised this gist Apr 30, 2012. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -7,8 +7,8 @@ near = {}
    if (thing != undefined) {
    near[thing._id] = [];
    allTheThings.forEach(function (thing2) {
    if(thing2.x >+ thing.x-5 && thing2.x <+ thing.x+5) {
    if(thing2.x >+ thing.x-5 && thing2.x <+ thing.x+5) {
    if(thing2.x >= thing.x-5 && thing2.x <= thing.x+5) {
    if(thing2.y >= thing.y-5 && thing2.y <= thing.y+5) {
    near[thing._id].push thing2;
    }
    }
  4. jonathanKingston created this gist Apr 30, 2012.
    20 changes: 20 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,20 @@
    Meteor.setInterval(function() {

    var allTheThings = Things.find({});
    near = {}
    allTheThings.forEach(function (thing) {

    if (thing != undefined) {
    near[thing._id] = [];
    allTheThings.forEach(function (thing2) {
    if(thing2.x >+ thing.x-5 && thing2.x <+ thing.x+5) {
    if(thing2.x >+ thing.x-5 && thing2.x <+ thing.x+5) {
    near[thing._id].push thing2;
    }
    }
    });

    }
    }

    },5000);