library('httr')
btoken <- '<token>' # go to https://bitly.com/a/oauth_apps and generate token
args <- list(query='obama', domain='nytimes.com', limit=2, access_token = btoken)
req <- GET("https://api-ssl.bitly.com/v3/search", query=args)
content(req)
This file contains 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
bootstrap.list <- c("car", | |
"codetools", | |
"colorspace", | |
"data.table", | |
"devtools", | |
"dplyr", | |
"forecast", | |
"ggplot2", | |
"knitr", | |
"lattice", |
This file contains 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
### tweetdata.r | |
### Fetch Twitter data and Data Transformations | |
### Requires you have authenticated in auth.R | |
### 15th June 2014 | |
### Mark Edmondson @HoloMarkeD | |
### | |
### For use with Twitter API, processTweets() takes the df$tweetDF data.frame as input | |
### And calculates/transforms data for the plots | |
processTweets <- function(tweetDF, |
This file contains 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
### plotTweets.r | |
### Plot out tweets | |
### Requires you have authenticated in auth.R and processed in tweetdata.R | |
### 15th June 2014 | |
### Mark Edmondson @HoloMarkeD | |
### | |
library(ggplot2) | |
###################################################################### |
This file contains 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
### Function for generating the posterior of Robo's position ### | |
landscape <- c(rep("plain", 50), rep("mountain", 25), rep("forest", 45)) | |
landscape_color <- c(mountain = "black", forest = "green", plain = "yellow") | |
cover_cost <- c(mountain = 10, forest = 5, plain = 1) | |
posterior_sample <- function(n) { | |
dist_i <- sample(3, n, replace = TRUE, c(18, 17, 65)) | |
mu <- c(15, 40, 90) |
This file contains 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
x <- c( | |
'knitr', # A general-purpose package for dynamic report generation in R. | |
# 'sqldf', # For running SQL statements on R data frames, optimized for convenience. | |
'randomForest', # Classification and regression based on a forest of trees using random inputs. | |
'arm', # R functions for processing lm, glm, svy.glm, mer and polr outputs. | |
'ggplot2', # An implementation of the Grammar of Graphics. | |
'gridExtra', # misc. high-level Grid functions | |
'plyr', # Tools for splitting, applying and combining data. | |
'tree', # Classification and regression trees. | |
'gbm', # Generalized Boosted Regression Models |
This file contains 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
/*********** | |
* Collects the reporting results from all accounts | |
* and generates a nicely formatted email. If there | |
* are errors for an account, it includes those | |
* in the email as well since an error in one account | |
* won't stop the entire script. | |
***********/ | |
function generateReport(results) { | |
var NOTIFY = ['your_email@example.com']; | |
var total_deleted = 0; |
This file contains 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
function main() { | |
Logger.log('AdWordsApp.extensions().sitelinks() list.'); | |
logSitelinks(AdWordsApp); | |
Logger.log('Campaign and AdGroup list.'); | |
var campIter = AdWordsApp.campaigns().get(); | |
while(campIter.hasNext()) { | |
var camp = campIter.next(); | |
logSitelinks(camp); | |
var agIter = camp.adGroups().get(); |
This file contains 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
### r-installation-debain-wheezy | |
#### setup commands to setup R, RStudio and OpenCPU on a Google Compute Engine Wheezy instance | |
#### Mark Edmondson 29 June 2014 | |
## | |
## No original work, all taken from these sources: | |
## https://github.com/jeroenooms/opencpu-deb/blob/master/build-on-debian.md | |
## https://support.rstudio.com/hc/communities/public/questions/200651456-RStudio-server-not-installable-on-Debian-Wheezy-just-released-this-week- | |
## http://cran.r-project.org/bin/linux/debian/README.html | |
# need to be sudo for all below |
This file contains 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
require 'spintax_parser' | |
class String | |
include SpintaxParser | |
end | |
spintext = %{ | |
>"Templates may seem like a terrible way to produce sentences until you consider the alternatives." --[Chris Pressey](https://github.com/dariusk/NaNoGenMo-2015/issues/16) | |
{How can you|Is it possible to|How on earth do you} {build|create|come up with|compose} an {algorithm|program} {to build|to create|for making} 'human-readable' novels? While {there was|there has been} [several](https://en.wikipedia.org/wiki/Just_This_Once) [attempts](https://en.wikipedia.org/wiki/Racter) made, {people|individuals|humans|human beings} {never|has not|has not yet|haven't} {reached|arrived at|spotted|located|stumbled on|found} a good "answer" {to that particular|to this} question... yet. |
OlderNewer