Skip to content

Instantly share code, notes, and snippets.

View lukereding's full-sized avatar

luke reding lukereding

View GitHub Profile
require(tidyverse)
# computes things you want to know across the entire trial
do_it <- function(x) {
name <- x$filename[1]
fish_name <- name %>% stringr::str_match(pattern = "_S[a-z]+?_([A-Za-z]+)_") %>% as.vector %>% .[2]
temp <- x %>%
mutate(time_zone = lead(time) - time) %>%
group_by(code) %>%
@lukereding
lukereding / party_flyer.R
Created April 14, 2018 21:30
Code to reproduce the flyer for john and I's graduation party
# edited from https://github.com/aschinchon/travelling-salesman-portrait/blob/master/frankenstein_TSP.R
library(imager)
library(dplyr)
library(ggplot2)
library(scales)
library(TSP)
urlfile <- "https://www.dropbox.com/s/4td7zbqohyw0f3g/creepy.jpg?dl=0"
library(tidyverse)
## testing overall incidence of intransitivity
# number of intransitive fish in each experiment per the results
intransitive <- c(9, 6, 6)
# total number of fish in each experiment
total <- c(10, 11, 23) + intransitive
@lukereding
lukereding / get_issue_comments.py
Created November 24, 2019 15:34
Summary counts of comments on issues by users in a github repo
import requests
import pandas as pd
import altair as alt
from typing import List, Tuple
def download_comments(repo: str, user: str) -> List[str]:
url = f"https://api.github.com/repos/{user}/{repo}/issues/comments"
res = requests.get(url)
if res.ok:
@lukereding
lukereding / new_python38_39.md
Created June 23, 2021 10:36
New features in python 3.8 and 3.9

What's new in Python 3.8

The walrus operator

:= lets you assign variables as part of larger expressions.

Example: