Skip to content

Instantly share code, notes, and snippets.

View ToeJamson's full-sized avatar

Joe Hanson ToeJamson

  • @observe.ai
  • San Francisco, CA
View GitHub Profile
// ES document structure
meeting : {
"criteria":{
"type":"nested",
"properties":{
"id":{
"type":"keyword"
},
"present":{
"type":"integer"
@ToeJamson
ToeJamson / 1.html
Created March 21, 2018 17:24
location
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&key=YOUR_GOOGLE_MAPS_API_KEY&callback=initialize"></script>
</body>
</html>
setInterval(function() {
pubnub.publish({channel:pnChannel, message:{lat:window.lat + 0.001, lng:window.lng + 0.01}});
}, 500);
</script>
@ToeJamson
ToeJamson / init.js
Created March 21, 2018 17:23
location
var pnChannel = "map3-channel";
var pubnub = new PubNub({
publishKey: 'YOUR_PUB_KEY',
subscribeKey: 'YOUR_SUB_KEY'
});
pubnub.subscribe({channels: [pnChannel]});
pubnub.addListener({message:redraw});
@ToeJamson
ToeJamson / latlong.js
Created March 21, 2018 17:23
location
var redraw = function(payload) {
lat = payload.message.lat;
lng = payload.message.lng;
map.setCenter({lat:lat, lng:lng, alt:0});
mark.setPosition({lat:lat, lng:lng, alt:0});
lineCoords.push(new google.maps.LatLng(lat, lng));
var lineCoordinatesPath = new google.maps.Polyline({
path: lineCoords,
geodesic: true,
strokeColor: '#2E10FF'
@ToeJamson
ToeJamson / define.js
Created March 21, 2018 17:22
location
var map;
var mark;
var lineCoords = [];
var initialize = function() {
map = new google.maps.Map(document.getElementById('map-canvas'), {center:{lat:lat,lng:lng},zoom:12});
mark = new google.maps.Marker({position:{lat:lat, lng:lng}, map:map});
};
window.initialize = initialize;
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&key=YOUR_GOOGLE_MAPS_API_KEY&callback=initialize"></script>
</body>
</html>
@ToeJamson
ToeJamson / latlong.js
Created March 20, 2018 22:16
location
setInterval(function() {
pubnub.publish({channel:pnChannel, message:currentLocation()});
}, 5000);
</script>
@ToeJamson
ToeJamson / lib.js
Created March 20, 2018 22:16
location
var pnChannel = "map2-channel";
var pubnub = new PubNub({
publishKey: 'YOUR_PUB_KEY',
subscribeKey: 'YOUR_SUB_KEY'
});
pubnub.subscribe({channels: [pnChannel]});
pubnub.addListener({message:redraw});
@ToeJamson
ToeJamson / redraw2.js
Created March 20, 2018 22:15
location
var redraw = function(payload) {
lat = payload.message.lat;
lng = payload.message.lng;
map.setCenter({lat:lat, lng:lng, alt:0});
mark.setPosition({lat:lat, lng:lng, alt:0});
};