Created
January 6, 2014 23:26
-
-
Save andresilva/8291852 to your computer and use it in GitHub Desktop.
mucuchies
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var weatherSource = Dashboard.PeriodicSource.create({ | |
period: 300000, | |
dataUpdate: function(callback) { | |
var query = "select * from weather.forecast WHERE woeid=746203 and u='c'&format=json" | |
var req = { | |
url: "http://query.yahooapis.com/v1/public/yql?q=" + encodeURI(query) | |
}; | |
$.get("/get", req, function(data) { | |
var results = data.query.results; | |
var condition = results.channel.item.condition; | |
callback({ | |
temperature: condition.temp, | |
code: condition.code, | |
city: results.channel.location.city | |
}) | |
}); | |
} | |
}); | |
Dashboard.WeatherWidget.create({ | |
row: 1, col: 1, sizex: 1, sizey: 1, | |
showLastUpdated: true, | |
source: weatherSource | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment