Skip to content

Instantly share code, notes, and snippets.

self.times = self.times || [];
for(i=self.timeSlider.bins.length;i<self.timeSlider.timeStops.length-1;i++) {
self.timeSlider.bins.push({"count": 0, "timestamp": self.timeSlider.timeStops[i], 'epoch': self.timeSlider.timeStops[i].getTime()});
}
var maxExtent = self.timeSlider.bins[self.timeSlider.bins.length - 1].epoch;
var length = self.timeSlider.bins.length;
console.log('bins.length', length)
console.log('maxExtent', maxExtent);
opts { source: 'tweetsponge',
sourceConfig:
{ id: 'tweets_512313b623612fb',
keywords: [ 'Obama' ],
limit: 200,
socket_url: 'ws://192.168.0.5:5001' },
id: 'tweets_512313b623612fb' }
socket_connection undefined
{"serviceName":"tweets_1321913b8acc201b","type":"StreamServer","description":"Tweets that mention ... beep boop","extent":{"rings":[[]],"spatialReference":{"wkid":4326}},"persistFeatures":false,"datastore":"dbtest","fields":[{"name":"id","type":"esriFieldTypeOID","alias":"id"},{"name":"username","type":"esriFieldTypeString","alias":"tweeter"},{"name":"picture","type":"esriFieldTypeString","alias":"pictureurl"},{"name":"type","type":"esriFieldTypeString","alias":"type"},{"name":"content","type":"esriFieldTypeString","alias":"message"},{"name":"posted_time","type":"esriFieldTypeDate","alias":"posted_time"},{"name":"friends","type":"esriFieldTypeInteger","alias":"friends"},{"name":"followers","type":"esriFieldTypeInteger","alias":"followers"},{"name":"matching_keywords","type":"esriFieldTypeString","alias":"matching_keywords"},{"name":"stream_id","type":"esriFieldTypeString","alias":"stream_id"},{"name":"overlay_id","type":"esriFieldTypeString","alias":"overlay_id"}],"uniqueIdField":"id","entityIdField":null,"ti
var $window = $(window);
self.checkWidth = function(locate) {
var windowsize = $window.width();
if (windowsize < 500) {
self.is_mobile = true;
if (self.current_resort) {
$('.container').height(250);
$('#mobile_footer').show();
$('.mobile_name').show();
}
//basic
params {
sources: {
twitter: {keywords: ['snow', 'rain', 'wind']}
}
period: {
start: t1, end: t2
}
limit: 300 //for testing purposes, replace with period
style: {
//create the bins
while (min < this.visibleTimeExtent[1]) {
res_stops[min] = 0;
min = min+step;
}
res_stops[this.visibleTimeExtent[1]] = 0;
//fill the bins
for (time in this.timeHash) {
for (stop in res_stops) {
[2, 4, 1, 3, 5: 1, 6: 2, 8: 3, 9: 2, 10: 1, 11: 1, 12: 1, 13: 3, 15: 1, 16: 1, 17: 2, 18: 2, 19: 2, 20: 2, 21: 1, 22: 2, 23: 3, 24: 2, 25: 2, 26: 1, 28: 2, 29: 1, 30: 1, 31: 2, 32: 2, 33: 2, 35: 3, 36: 3, 37: 3, 38: 2, 39: 2, 40: 3, 41: 5, 42: 2, 43: 3, 45: 2, 46: 2, 47: 2, 49: 1, 50: 2, 51: 1, 52: 3, 53: 1, 54: 1, 57: 1, 58: 3, 62: 3, 63: 1, 64: 2, 65: 2, 66: 1, 68: 2, 71: 3, 72: 2, 74: 2, 75: 1, 76: 1, 77: 1, 79: 2, 80: 1, 81: 1, 82: 1, 83: 2, 84: 1, 85: 3, 86: 2, 87: 2, 89: 1, 90: 3, 91: 1, 93: 1, 95: 2, 96: 3, 97: 2, 98: 1, 99: 6, 100: 3, 101: 1, 103: 4, 104: 2, 105: 2, 106: 1, 107: 3, 108: 1, 112:1 ]
var prev = this._numeric_resolution;
var min = this.visibleDataExtent[0];
var range = this.visibleDataExtent[1] - this.visibleDataExtent[0];
this._resolution = this._findRes( range );
this._numeric_resolution = this._resolutions[this._resolution];
var counter = {};
this.bins.forEach(function(n,i) {
var length = this.sliderMaster[ "esriTimeUnitsSeconds" ].length * 60;
var min = Math.floor( length / 6000 );
var hour = Math.floor( length / 3600000 );
var day = Math.floor( length / 86400000 );
var month = Math.floor( length / 2592000000 );
this.sliderMaster[ "esriTimeUnitsMinutes" ][ min ]++;
this.sliderMaster[ "esriTimeUnitsHours" ][ hour ]++;
this.sliderMaster[ "esriTimeUnitsDays" ][ day ]++;
{
"Yankees" : {
"Alex Rodriguez" : {"salary" : 30000000, "position" : "Third Baseman" },
"Mark Teixeira" : {"salary" : 23125000, "position" : "First Baseman" },
"CC Sabathia" : {"salary" : 23000000, "position" : "Pitcher" },
"Derek Jeter" : {"salary" : 15729364, "position" : "Shortstop"},
"Mariano Rivera" : {"salary" : 14940025, "position" : "Pitcher"},
"Robinson Cano" : {"salary" : 14000000, "position" : "Second Baseman" },
"Rafael Soriano" : {"salary" : 11000000, "position" : "Pitcher" },
"Nick Swisher" : {"salary" : 10250000, "position" : "Outfielder" },