Skip to content

Instantly share code, notes, and snippets.

💭
Hungry

Matt Sandy MattSandy

💭
Hungry
Block or report user

Report or block MattSandy

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@MattSandy
MattSandy / run.R
Created Sep 13, 2019
Third Democratic Debate
View run.R
library(tidyverse)
library(rvest)
library(data.table)
library(quanteda)
library(magrittr)
library(ggthemes)
url <- "https://www.washingtonpost.com/" %>%
paste0("politics/2019/09/13/transcript-third-democratic-debate/")
transcript <- url %>% read_html %>%
@MattSandy
MattSandy / front_page.R
Created Sep 3, 2019
Gets the subreddits that made it to the front page the most often
View front_page.R
library(tidyverse)
library(jsonlite)
library(plotly)
# Figure out which columns are lists
drop_lists <- function(df) {
for(column in names(df)) {
if(typeof(df[[column]])=="list") {
# Remove column
df[[column]] <- NULL
@MattSandy
MattSandy / run.js
Last active Aug 14, 2019
Get character length of every document on the page
View run.js
var all = document.getElementsByTagName("*");
var tags = [];
var tmp = 0;
for (var i=0, max=all.length; i < max; i++) {
tmp = 0;
jQuery.each(all[i].attributes,function(pos,element){
tmp = tmp + element.name.length + element.value.length;
});
tmp = tmp + jQuery(all[i]).html().length;
if(typeof(tags[jQuery(all[i]).prop("tagName")]) == "undefined") {
@MattSandy
MattSandy / Candidate_Bigrams.png
Last active Aug 1, 2019
Candidate bigrams from the July 30th, 2019 Democratic Debate
@MattSandy
MattSandy / album_counts.R
Created Jul 26, 2019
Find the cumulative number of albums an artist has released and predict future counts.
View album_counts.R
# https://en.wikipedia.org/wiki/The_Mountain_Goats_discography
# Scraping
library("rvest")
library("ggplot2")
library("ggthemes")
library("stringr")
library("tidyverse")
tbls <- "https://en.wikipedia.org/wiki/The_Mountain_Goats_discography" %>%
read_html %>% html_nodes("table")
@MattSandy
MattSandy / OfflineCallConversionFeedService.md
Last active May 23, 2019
Offline Conversion Tracking Information
View OfflineCallConversionFeedService.md

Offline Conversion Tracking

Google Page

Upload call conversions

An UploadCallConversion maps to the Import conversion source in the Google Ads UI followed by choosing Conversion from calls.

A mobile click-to-call click cannot be uploaded as a conversion if there is no Google forwarding number attached to the call. Without a Google forwarding number, there is no way Google can be sure that the click led to a call and then to a conversion. If a click is uploaded like this, it will be ignored by the conversion tracker.

Once you create an UploadCallConversion, you can use the OfflineCallConversionFeedService to upload conversions for calls. See Importing Call Conversions below for details.

@MattSandy
MattSandy / avengers.R
Created May 7, 2019
IMDB scraping for Avengers:Endgame reviews
View avengers.R
library(rvest)
library(magrittr)
library(stringr)
library(lubridate)
library(data.table)
library(ggplot2)
library(patchwork)
library(tidyverse)
# Functions ---------------------------------------------------------------
@MattSandy
MattSandy / scan.php
Created Feb 9, 2019
Scans the current directory and subdirectories for files which contain eval(), base64_decode(), or exec() references.
View scan.php
<?php
error_reporting(0);
if(isset($_GET['file'])) {
highlight_file(urldecode($_GET['file']));
die();
} else if(isset($_GET['del'])) {
unlink(urldecode($_GET['del']));
echo "file deleted";
die();
}
@MattSandy
MattSandy / tree.R
Created Dec 6, 2018
Christmas Tree
View tree.R
bulbs <- data.frame(x=c(300,500,650,400,600,500,450,500,500),y=(seq(100,600,60)/1.2))
s <- sample(0:1500)
r <- 0:500
mid <- 500
center <- rep(500,length(r))
tree <- data.frame(x = c(r,center,rev(r)+mid,center),
y = c(r,r+50,r,r+50),
g = c(s[r+1],s[r+1],s[r+mid*2],s[r+mid*2]))
ggplot(tree,aes(x=x,y=y)) +
geom_line(aes(group = g, colour = g),
@MattSandy
MattSandy / clock.R
Last active Nov 9, 2018
ggplot clock
View clock.R
ggplot(data.frame(t = c(1:60)),aes(t,3)) + geom_point() +
geom_point(data = data.frame(t = c(seq(0,11)*5),3),
aes(t,3,color=factor(t)), size=5) +
coord_polar() +
scale_x_continuous(labels = c(12,3,6,9),
breaks = c(0,15,30,45)) +
scale_y_continuous(limits = c(0,3)) +
theme_bw(base_size = 22) +
theme(title = element_blank(),
legend.key = element_blank(),
You can’t perform that action at this time.