Skip to content

Instantly share code, notes, and snippets.

View jthomasmock's full-sized avatar

Tom Mock jthomasmock

View GitHub Profile
@zanshin
zanshin / .zshrc
Created August 12, 2011 19:09
My .zshrc file
# Path to your oh-my-zsh configuration.
export ZSH=$HOME/.oh-my-zsh
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
#export ZSH_THEME="robbyrussell"
export ZSH_THEME="zanshin"
@rchowe
rchowe / .bashrc
Created February 3, 2012 02:41
Sample .bashrc
##
## Slightly nicer .bashrc
## Makes pretty colors and stuff
##
## Set $PATH, which tells the computer where to search for commands
export PATH="$PATH:/usr/sbin:/sbin:/bin:/usr/bin:/etc:/usr/ucb:/usr/local/bin:/usr/local/local_dfs/bin:/usr/bin/X11:/usr/local/sas"
## Where to search for manual pages
export MANPATH="/usr/share/man:/usr/local/man:/usr/local/local_dfs/man"
library(tidycensus)
library(tidyverse)
library(extrafont)
city16 <- get_acs(geography = "place",
variables = "B01003_001",
survey = "acs1") %>%
filter(estimate > 500000) %>%
rename(estimate16 = estimate)
@samclifford
samclifford / tidy_nfl.R
Created April 9, 2018 14:31
Tidy Tuesday NFL challenge
library(tidyverse)
library(hrbrthemes)
# download https://github.com/rfordatascience/tidytuesday/blob/master/data/tidy_tuesday_week2.xlsx
football <- read_xlsx("data/tidy_tuesday_week2.xlsx")
# get the top 16 paid players in each position for each year
to_plot <- football %>%
mutate(Team = 1:nrow(.)) %>%
gather(position, salary, -c(year, Team)) %>%
@gadenbuie
gadenbuie / xaringan-decouple-code-plot.Rmd
Last active November 22, 2021 16:54
Decouple code and plots (or results) in xaringan slides
---
title: "Decouple Code and Output in xaringan slides"
subtitle: "Demo Slides for <a href='https://garrickadenbuie.com/blog/2018/08/14/decouple-code-and-output-in-xaringan-slides/'>Related Blog Post</a>"
author: "Garrick Aden-Buie"
date: "`r Sys.Date()`"
output:
xaringan::moon_reader:
lib_dir: libs
nature:
ratio: 16:9
@adamconroy
adamconroy / community.rstudio.com-dark.css
Last active September 12, 2018 17:49
RStudio Community Site dark style/theme
body {
background-color: #1d1d1d;
color: #e2e2e2;
font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";
line-height: 1.5;
}
a {
color: #509eeb;
}
# Load the packages we’re going to be using:
# Alongside the usual stuff like tidyverse and magrittr, we’ll be using rvest for some web-scraping, jsonline to parse some JSON, and extrafont to load some nice custom fonts
needs(tidyverse, magrittr, rvest, jsonlite, extrafont)
# Before we go on, two things to note:
# First, on web scraping:
# You should always check the terms of the site you are extracting data from, to make sure scraping (often referred to as `crawling`) is not prohibited. One way to do this is to visit the website’s `robots.txt` page, and ensure that a) there is nothing explicitly stating that crawlers are not permitted, and b) ideally, the site simply states that all user agents are permitted (indicated by a line saying `User-Agect: *`). Both of those are the case for our use-case today (see https://www.ultimatetennisstatistics.com/robots.txt).
# And second, about those custom fonts:
@guga31bb
guga31bb / box_score.md
Last active May 16, 2021 22:35
Make pretty box scores

Make box scores with EPA and other stuff

Code below. To get the game you want, need to choose season, type (regular, postseason, etc), home team, away team, and the rest will go on itself.

Code from @benbbaldwin

library(nflscrapR)
library(tidyverse)
library(na.tools)
read_csv("https://raw.githubusercontent.com/CSSEGISandData/COVID-19/master/csse_covid_19_data/csse_covid_19_time_series/time_series_19-covid-Confirmed.csv") %>%
gather(date, cases, 5:ncol(.)) %>%
mutate(date = as.Date(date, "%m/%d/%y")) %>%
group_by(country = `Country/Region`, date) %>%
summarise(cases = sum(cases)) %>%
filter(country != "Others" & country != "Mainland China") %>%
bind_rows(
tibble(country = "Republic of Korea", date = as.Date("2020-03-11"), cases = 7755)
) %>%
group_by(country) %>%
library(tweetrmd)
library(htmltools)
library(reactable)
x <- tibble::tibble(
name = c("Tom", "Julia"),
handle = c("@thomas_mock", "@b0rk"),
tweet = c(
"https://twitter.com/thomas_mock/status/1294670115590545408",
"https://twitter.com/b0rk/status/1295029728127135746"