Skip to content

Instantly share code, notes, and snippets.

Ben Bailey benfb

Block or report user

Report or block benfb

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
@benfb
benfb / fangraphs-baseball.jl
Created Jun 15, 2019
A rough draft of a Julia script to create a DataFrame from Fangraphs data
View fangraphs-baseball.jl
using Gumbo
using Cascadia
using Tables
using DataFrames
using CSV
import HTTP
r = HTTP.request("GET", "https://www.fangraphs.com/leaders.aspx?pos=all&stats=rel&lg=0&qual=10&type=c,-1,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238
View spring-outliers.r
library(dplyr)
library(stringr)
library(baseballr)
guts2019 <- fg_guts() %>% filter(season == "2019")
spring <- read.csv("spring2019.csv") %>%
select(-Rk) %>%
filter(PA > 0) %>%
rowwise() %>%
mutate(mlbID = stringr::str_split(Name, "mlb_ID=")[[1]][[2]],
View Calculator.java
//I accidentally switched up operand and operator, but the program has the same effect
public class Calculator
{
//instance variables
private double num1;
private double num2;
private char operand;
//default constructor
public Calculator()
View bryant.r
library(baseballr)
library(dplyr)
bryant <- scrape_statcast_savant_batter(start_date = "2016-04-03", end_date = "2016-10-03", batterid = 592178)
bryant_reds <- bryant %>%
mutate(reds = away_team == "CIN" | home_team == "CIN") %>%
group_by(reds) %>%
summarize(
avg_launchangle = mean(as.numeric(as.character(hit_angle)), na.rm = TRUE),
View pitcher_by_inning_2016.r
library(baseballr)
library(Lahman)
library(dplyr)
library(ggplot2)
library(reshape2)
library(stringr)
library(tidyr)
library(ggthemes)
library(grid)
library(gridExtra)
View playername_lookup.r
playername_lookup <- function(string=NULL) {
if (!exists("chadwick_player_lu_table")) {
print("Be patient, this may take a few seconds...")
print("Data courtesy of the Chadwick Bureau Register (https://github.com/chadwickbureau/register)")
id <- string
url <- "https://raw.githubusercontent.com/chadwickbureau/register/master/data/people.csv"
chadwick_player_lu_table <- read.csv(url)
assign("chadwick_player_lu_table", chadwick_player_lu_table, envir = .GlobalEnv)
x <- chadwick_player_lu_table %>%
filter(key_mlbam == id) %>%
View keybase.md

Keybase proof

I hereby claim:

  • I am benfb on github.
  • I am benfb (https://keybase.io/benfb) on keybase.
  • I have a public key ASDC7AidB9kinXSgUCKdEfUYBWR_T_cMkZj5Zgf_K2dYBgo

To claim this, I am signing this object:

View VigenereRunner.java
import java.util.Scanner;
public class VigenereRunner
{
public static void main(String[] args)
{
//instantiate a Scanner object
Scanner scan = new Scanner(System.in);
//prompt the user for the text to encrypt
View WordSearchRunner.java
import java.util.Scanner;
import java.io.*;
import java.util.Arrays;
public class WordSearchRunner
{
public static void main(String[] args) throws FileNotFoundException
{
// instantiate Scanner object to read in from file
Scanner ws = new Scanner(new File("hidden.txt"));
View Vigenere.java
public class Vigenere
{
//declare instance variables for text and keyword
private String pt = "";
private String key = "";
Vigenere(){ //default constructor
pt = "";
key = "";
}
You can’t perform that action at this time.