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
julia_tweets = get_search_tweets("#julialang") |
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
post_status_update("Hello, World!") |
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
using Twitter | |
apikey = "q8Qw7WJTVP..." | |
apisecret = "FIichPpGJxiOssN..." | |
accesstoken = "98689850-v0zZNr..." | |
accesstokensecret = "w7bDg9K0c493T..." | |
twitterauth(apikey, | |
apisecret, | |
accesstoken, |
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
REQUEST: | |
{ | |
"reportDescription":{ | |
"dateFrom":"2013-01-01", | |
"dateTo":"2013-11-16", | |
"reportSuiteID":"", | |
"segment_id":"53c059aee4b07cd3c4332163", | |
"metrics":[ | |
{ | |
"id":"bouncerate" |
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
macro endpoint(name, path) | |
quote | |
function $(esc(name))(; options=Dict{String, String}()) | |
r = get_oauth($"https://api.twitter.com/1.1/$path", options) | |
return r.status == 200 ? JSON.parse(r.data) : r | |
end | |
end | |
end | |
@endpoint get_help_configuration "help/configuration.json" |
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
funcname = (:get_help_configuration, :get_help_languages, :get_help_privacy, :get_help_tos, :get_application_rate_limit_status) | |
endpoint = ("help/configuration.json", "help/languages.json", "help/privacy.json", "help/tos.json", "application/rate_limit_status.json") | |
for (func, endp) in zip(funcname, endpoint) | |
@eval function ($func)(; options=Dict{String, String}()) | |
r = get_oauth($"https://api.twitter.com/1.1/$endp", options) | |
return r.status == 200 ? JSON.parse(r.data) : r |
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
############################################################# | |
# | |
# Help section Functions for Twitter API | |
# | |
############################################################# | |
function get_help_configuration(; options=Dict{String, String}()) | |
r = get_oauth("https://api.twitter.com/1.1/help/configuration.json", options) |
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
#Plot data using ggplot2 | |
library(ggplot2) | |
#Calculate points crossing UCL or LCL | |
pageviews_w_forecast$outliers <- | |
ifelse(pageviews_w_forecast$pageviews > pageviews_w_forecast$upperBound.pageviews, pageviews_w_forecast$pageviews, | |
ifelse(pageviews_w_forecast$pageviews < pageviews_w_forecast$lowerBound.pageviews, pageviews_w_forecast$pageviews, NA)) | |
#Add LCL and UCL labels | |
LCL <- vector(mode = "character", nrow(pageviews_w_forecast)) |
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
res <- breakout(formatted_df, min.size=5, method='multi', beta=.001, degree=1, plot=TRUE) | |
res$plot |
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
res <- breakout(formatted_df, min.size=24, method='multi', beta=.001, degree=1, plot=TRUE) | |
res$plot |