An open API service indexing awesome lists of open source software.

https://github.com/bumi/travels

my travel log as git commits
https://github.com/bumi/travels

Last synced: 4 months ago
JSON representation

my travel log as git commits

Awesome Lists containing this project

README

          

# [where.is.michaelbumann.com](http://where.is.michaelbumann.com)

my location log stored in [git commits](https://github.com/bumi/travels/commits/locations) (in the locations branch). Have a look at [where.is.michaelbumann.com](http://where.is.michaelbumann.com) for a nice map and list of recent places.

Got a recommendation for a place I should visit? Please create an [issue](https://github.com/bumi/travels/issues/new).

## Development

### All in one:
adds location entries to an `ul.location-list`, fills `.current-location` and `.next-locaton`

```javascript

$.get('https://api.github.com/repos/bumi/travels/commits?sha=locations', function(commits) {
var max = commits.length;// > 11 ? 11 : commits.length;
var future = [];
var past = [];
commits = commits.sort(function(c1, c2) {
var d1 = new Date(c1.commit.author.date);
var d2 = new Date(c2.commit.author.date);
if(d1 < d2) { return 1; }
if(d1 > d2) { return -1; }
return 0;
});
for(var i=0; i < max; i++) {
try {
var c = commits[i].commit;
var commitMessage = c.message.split("\n");
var data = JSON.parse(commitMessage[commitMessage.length-1]);
var arrival = new Date(c.author.date);
var area = data.city || data.state || 'somewhere';

var message = area + ', ' + data.country;
if(arrival > new Date()) {
$('.next-location').html('Planned: ' + message + ' (' + arrival.toDateString() + ')'); // assumin the last commit in the future is the next stop. which is wrong, needs to get smarter and calculate the nearest in the future
$('.location-list').append('

  • ' + message + ' (' + arrival.toDateString() + ')
  • ');
    future.push(c);
    } else {
    if(past.length === 0) {
    $('.current-location').html(message); // assuming the first in the past is the current location
    }
    $('.location-list').append('
  • ' + message + '
  • ');
    past.push(c);
    }

    $('.location').show();

    } catch(e) {
    // ignore
    }
    };
    });

    ```

    ### Get latest location:

    ```javascript
    $.get('https://api.github.com/repos/bumi/travels/commits?sha=locations', function(commits) {
    for(var i=0; i < commits.length; i++) {
    try {
    var c = commits[i].commit;
    var commitMessage = c.message.split("\n");
    var data = JSON.parse(commitMessage[commitMessage.length-1]);
    var area = data.city || data.state || 'somewhere';
    $('.current-location').html(area + ' in ' + data.country);
    $('.location').show();
    return true;
    } catch(e) {
    }
    };
    });
    ```

    ### Get list of locations:

    ```javascript
    $.get('https://api.github.com/repos/bumi/travels/commits?sha=locations', function(commits) {
    commits.forEach(function(commit) {
    try {
    var c = commit.commit;
    var commitMessage = c.message.split("\n");
    var data = JSON.parse(commitMessage[commitMessage.length-1]);
    var area = data.city || data.state || 'somewhere';
    $('.location-list').append('

  • ' + area + ' in ' + data.country + '
  • ');
    $('.location').show();
    return true;
    } catch(e) {
    }
    });
    });
    ```