Skip to content

Instantly share code, notes, and snippets.

@evanpeck
evanpeck / ClassConduct.md
Last active August 12, 2021 12:31
A code of conduct that is inserted into the syllabus of CS courses. I'd love to improve it + make it more actionable. Don't hesitate to suggest changes!

Code of Conduct

You have two primary responsibilities:

  • Promote an inclusive, collaborative learning environment.
  • Take action when others do not.

Professionally, we adhere to ACM’s Code of Ethics. More broadly, a course like INSERT COURSE NAME involves reflection, collaboration, and communication. Computer science has a checkered history with respect to inclusion – in corporate environments, in our classrooms, and in the products we create. We strive to promote characteristics of transparency and inclusivity that reflect what we hope our field becomes (and not necessarily what it has been or is now).

We reject behavior that strays into harassment, no matter how mild. Harassment refers to offensive verbal or written comments in reference to gender, sexual orientation, disability, physical appearance, race, or religion; sexual images in public spaces; deliberate intimidation, stalking, following, harassing photography or recording, sustained d

@monipip3
monipip3 / bls_gov.R
Created October 28, 2019 03:01
Webscraping all the Bureau Labor Stats tables and joining them into an R data frame
library(purrr)
setwd("~/Desktop")
library(rvest)
if(!file.exists("./data/labor_data")) {dir.create("./data/labor_data")}
suppressPackageStartupMessages(library(lubridate))
suppressPackageStartupMessages(library(rvest))
#save url into a variable
url <- "https://www.bls.gov/lau/#tables"
@grantmcdermott
grantmcdermott / bboot.R
Last active May 6, 2022 18:50
Bayesian bootstrap
# Context: https://twitter.com/grant_mcdermott/status/1487528757418102787
library(data.table)
library(fixest)
bboot =
function(object, reps = 100L, cluster = NULL, ...) {
fixest_obj = inherits(object, c('fixest', 'fixest_multi'))
@debruine
debruine / doodle.R
Last active February 12, 2022 14:10
Deal with the terrible doodle format
library(dplyr)
library(tidyr)
library(readxl)
library(lubridate)
# deal with multi-line headers
data_head <- readxl::read_excel("Doodle.xls",
skip = 3, n_max = 3,
col_names = FALSE)
# Diversity along elevation gradient - pseudoreplication issue
# Elevation 200-1000 m asl, five elevation zones
# Richness (number of species) between 1-100 species
seed <- 56654
par (mfrow = c(2,2))
# Scenario 1: 5 replicate at each zone, each replicate at different mountain (random diversity)
@rasmusab
rasmusab / bowling-t-test.R
Created February 20, 2023 16:45
A much improved bowling T-test in R
bowling_animation_urls <- c(
"0.01" = "https://i.imgur.com/Kn8CQbj.gif",
"0.05" = "https://i.imgur.com/HFTKdDL.gif",
"0.1" = "https://i.imgur.com/8Sw54Mz.gif",
"1" = "https://i.imgur.com/kjROdhj.gif"
)
# We need to download the animations to the session temp dirercorty to display
# them in the Rstudio Viever pane
bowling_animation_html <- sapply(bowling_animation_urls, function(url) {