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
library("tidyverse") | |
library("rvest") | |
library("openxlsx") | |
library("ggthemes") | |
# Election Results -------------------------------------------------------- | |
column_names <- c("State", | |
"County_ID", | |
"Precinct_name", |
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 Twitter = require('twitter'); | |
var fs = require('fs'); | |
//https://apps.twitter.com/ | |
var client = new Twitter({ | |
consumer_key: '', | |
consumer_secret: '', | |
access_token_key: '', | |
access_token_secret: '' | |
}); |
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 regex_profession = "/(i am|am from|am a|i\'m).*(actor|puppeteer|marionetteer|actuary|administrative worker|advertising manager|aerial rigger|agricultural adviser|agricultural machinery mechanic|agronomist|air traffic controller|air traffic safety technician|aircraft instrument technician|aircraft mechanic|airline clerk|ammunition and explosives operative|animal technician|animator|anthropologist|applications manager|apprentice training officer|trainer|archeologist|architect|architectural conservation officer|art critic and historian|art glazier and window-pane maker|art metalworker|art photographer|art restorer|articled clerk - legal assistant|artificial flower maker|artistic promotions manager|assessor|assistant housekeeper|assistant printing worker|astrologer|astronomer|athlete|auctioneer|audio graphic designer|auditor|auto-electrician|auxiliary shop assistant|auxiliary worker in geological survey|auxiliary worker in textile and clothing industry|auxiliary worker in the timber industry|auxiliary worker |
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
library("lubridate") | |
library("patchwork") | |
library("viridisLite") | |
library("ggplot2") | |
library("jsonlite") | |
# http://www.trumptwitterarchive.com/archive | |
df <- read_json("data.json",simplifyVector = T) | |
df$date <- as.POSIXct(df$created_at, format = "%a %b %d %H:%M:%S + 0000 %Y") | |
df <- df[which(!is.na(df$date)),] | |
df$Hour <- hour(df$date) |
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
let fs = require('fs'); | |
let cheerio = require('cheerio'); | |
let rp = require('request-promise'); | |
var neighborhoods = { | |
'Calhoun Isles': 'a8a67acea57cb4dca5259bb46b201298', | |
'Camden': '0053599893439a3d71efd83852cd24d4', | |
'Central': 'd2c58b3f499c3269ab1c576e978e404b', | |
'Longfellow': '60ad517a63735568554252719020a854', | |
'Near North': 'c90b6b6a9af46e0a1f089abc480d73af', |
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 Twitter = require('twitter'); | |
var fs = require('fs'); | |
//Empty file | |
fs.writeFile('tweets.json', ""); | |
//https://apps.twitter.com/ | |
var client = new Twitter({ | |
consumer_key: '', | |
consumer_secret: '', | |
access_token_key: '', |
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
library("stringr") | |
ts <- stream_in(file("log.json")) | |
alcohol <- c("bar","beer","champagne","drink","drunk","liquir","whiskey","wine","champaign","whisky","liquor") | |
melt <- matrix(NA,nrow=0,ncol=2) | |
for(ref in alcohol) { | |
for(track in ts$title[grep(ref,ts$lyrics,ignore.case = T)]) { | |
for(i in 1:str_count(ts$lyrics[which(ts$title==track)],ref)) { | |
melt <- rbind(melt,c(track,ref)) | |
} | |
} |
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 app = require('express')(); | |
var server = require('http').Server(app); | |
var io = require('socket.io')(server); | |
var games = []; | |
var lookup = []; | |
server.listen(3000); | |
app.get('/', function (req, res) { | |
res.sendFile(__dirname + '/index.html'); |
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 pdfText = require('pdf-text'); | |
var fs = require('fs'); | |
var aggregate = {}; | |
var merchant = ""; | |
var amount = 0; | |
//clear export.csv and write heading | |
fs.writeFile('export.csv', 'Date,Merchant,Amount\n', function(){console.log('export.csv cleared')}); | |
pdfText("statement.pdf", function (err, chunks) { | |
for (var i = 0; i < chunks.length; i++) { | |
//finds the dates |
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
library("igraph") | |
library("networkD3") | |
library("data.table") | |
library("jsonlite") | |
library("data.table") | |
library("htmlwidgets") | |
AS.API <- "YOUR_API_KEY" | |
AS.URL <- paste0("http://ws.audioscrobbler.com/2.0/?method=artist.getsimilar&api_key=",AS_API,"&format=json&artist=") | |
AS.ARTISTS <- list() | |
get_similar <- function(artist,degree) { |