Skip to content

Instantly share code, notes, and snippets.

View kjhealy's full-sized avatar

Kieran Healy kjhealy

View GitHub Profile
library(tidycensus)
library(tigris)
library(ggiraph)
library(tidyverse)
us_median_age <- get_acs(
geography = "state",
variables = "B01002_001",
year = 2019,
survey = "acs5",
library(tidyverse)
library(calendar)
library(lubridate)
library(glue)
library(rvest)
strip_html <- function(s) {
html_text(read_html(charToRaw(s)))
}
library(dplyr, warn.conflicts = FALSE)
library(gapminder)
probs <- c(0.1, 0.5, 0.9)
gapminder %>%
group_by(continent) %>%
summarise(
probs = probs,
across(is.numeric & !year, ~ quantile(.x, probs))
)
@gaborcsardi
gaborcsardi / Pkgdown deploy from Travis.md
Last active November 17, 2021 13:41
Walkthrough: deploy a pkgdown site from Travis

Run usethis::use_pkgdown_travis()

usethis::use_pkgdown_travis()
✔ Setting active project to '/Users/gaborcsardi/works/ps'Adding 'docs/' to '.gitignore'Set up deploy keys by running `travis::use_travis_deploy()`Insert the following code in '.travis.yml'
  before_cache: Rscript -e 'remotes::install_cran("pkgdown")'
@wmay
wmay / latex_engine.Rmd
Last active December 2, 2019 02:30
Simple Latex knitr engine
---
title: "Latex engine test"
author: "William May"
date: "December 1, 2019"
output: pdf_document
---
```{r setup, include=FALSE}
library(knitr)
opts_chunk$set(echo = TRUE)
@johnjosephhorton
johnjosephhorton / uc_salaries_by_dept_and_rank.R
Created May 31, 2018 21:16
UC salaries by rank & dept
library(XML)
library(ggplot2)
df <- readHTMLTable("http://projects.dailycal.org/paychecker/departments/")[[1]]
DeMoney <- function(x) as.numeric(gsub(",", "", gsub("\\$", "", as.character(x))))
money.columns <- c("All", "Professor", "Associate professor", "Assistant professor",
"Lecturer")
@hrbrmstr
hrbrmstr / final.png
Last active March 3, 2019 05:27
composite a footer onto a ggplot plot – highly recommend doubling h & w, res = 144 and more customizing. this was a quick hack for someone.
final.png
# devtools::install_github("walkerke/tidycensus")
library(tidycensus)
library(tidyverse)
library(geofacet)
library(stringr)
library(extrafont)
# 2010 Census
age <- get_decennial(geography = "county", state = "AK", table = "P012",
@walesmd
walesmd / IconServiceAgent.md
Last active December 13, 2023 05:06
A lot of people are having issues with com.apple.IconServicesAgent. Since this is a very new issue, Google was no help and `man iconservicesd` is even more hilarious. I eventually fixed it, when I was working on a completely different issue (that is still not fixed). The instructions are below and on the Apple Support Forum, https://discussions.…

I was chasing down another issue (slow "Save As") and thought these two issues may have been related (with QuickLook being the common broken link). Unfortunately, my "Save As" dialog is still miserably slow on the initial load; but IconServicesAgent hasn't gone above 30MB and he rarely makes an appearance in the Console!

Some of these steps may not be necessary, but here are all of the steps I took that inadverdently put IconServicesAgent back in its place. Note: all commands are a single-line, if they appear to be multiple that's just the forum formatting.

  1. Check for any QuickLooks related .plist files. In a terminal: mdfind com.apple.quicklook. -name .plist

  2. I only had files at the system level (specifically within /System/Library/LaunchAgents/). If you have others, modify the directions below to take that into account (re-introducing plist files from the system level back up to the user).

  3. Make some temporary directories to store these plist files, just in case: mkdir ~/tmp-quicklook

anonymous
anonymous / redcarpet2_markdown.rb
Created October 16, 2013 20:21
redcarpet2_markdown with pygments
require 'fileutils'
require 'digest/md5'
require 'redcarpet'
require 'pygments'
class Redcarpet2Markdown < Redcarpet::Render::HTML
def block_code(code, lang)
lang = lang || "text"
colorized = Pygments.highlight(code, :lexer => lang, :options => { :style => "default", :encoding => 'utf-8'})
add_code_tags(colorized, lang)