Skip to content

Instantly share code, notes, and snippets.

View kjhealy's full-sized avatar

Kieran Healy kjhealy

View GitHub Profile
@kjhealy
kjhealy / Jekyll Liquid tag for MathJax.rb
Created September 26, 2011 14:00 — forked from jessykate/Jekyll nd Octopress Liquid tag for MathJax.rb
A simple liquid tag for Jekyll that converts {% m %} and {% em %} into inline math, and {% math %} and {% endmath %} into block equations, by replacing with the appropriate MathJax script tags.
module Jekyll
class MathJaxBlockTag < Liquid::Tag
def render(context)
'<script type="math/tex; mode=display">'
end
end
class MathJaxInlineTag < Liquid::Tag
def render(context)
'<script type="math/tex">'
end
@kjhealy
kjhealy / Makefile
Created October 25, 2012 21:53 — forked from even4void/Makefile
A sample demo of R Markdown with pandoc
RMDFILE=demo-rmd-pandoc
PANDOC=~/.cabal/bin/pandoc
all:
Rscript -e "require(knitr); require(markdown); knit('$(RMDFILE).rmd', '$(RMDFILE).md'); purl('$(RMDFILE).rmd')"
${PANDOC} --mathjax --toc -B header.html -A footer.html --bibliography refs.bib --css markdown.css -s $(RMDFILE).md -o $(RMDFILE).html
@kjhealy
kjhealy / gist:4049619
Created November 10, 2012 02:42 — forked from richfitz/gist:2324707
Install MinionPro on OSX
#!/bin/sh
## Information
## http://carlo-hamalainen.net/blog/2007/12/11/installing-minion-pro-fonts/
## http://www.ctan.org/tex-archive/fonts/mnsymbol/
## 0.1: Install LCDF Typetools
## http://www.lcdf.org/type/
## If you use Homebrew (http://mxcl.github.com/homebrew/), then uncomment:
# brew install lcdf-typetools
@kjhealy
kjhealy / gist:4100643
Created November 17, 2012 22:07 — forked from samsonjs/gist:4076746
Compiling and running mosh on Dreamhost
PREFIX=$HOME
VERSION=1.2.3
# Install Protocol Buffers
wget http://protobuf.googlecode.com/files/protobuf-2.4.1.tar.bz2
tar -xf protobuf-2.4.1.tar.bz2
cd protobuf-2.4.1
./configure --prefix=$PREFIX
make
make install
doInstall <- TRUE # Change to FALSE if you don't want packages installed.
toInstall <- c("sna", "ggplot2", "Hmisc", "reshape2")
if(doInstall){install.packages(toInstall, repos = "http://cran.r-project.org")}
lapply(toInstall, library, character.only = TRUE)
# Empty ggplot2 theme
new_theme_empty <- theme_bw()
new_theme_empty$line <- element_blank()
new_theme_empty$rect <- element_blank()
new_theme_empty$strip.text <- element_blank()
doInstall <- TRUE
toInstall <- c("ggplot2", "poLCA", "reshape2")
if(doInstall){install.packages(toInstall, repos = "http://cran.us.r-project.org")}
lapply(toInstall, library, character.only = TRUE)
ANES <- read.csv("http://www.oberlin.edu/faculty/cdesante/assets/downloads/ANES.csv")
ANES <- ANES[ANES$year == 2008, -c(1, 11, 17)] # Limit to just 2008 respondents,
head(ANES) # remove some non-helpful variables
# Adjust so that 1 is the minimum value for each variable:
ANES <- data.frame(apply(ANES, 2, function(cc){ cc - min(cc, na.rm = T) + 1 }))
We can't make this file beautiful and searchable because it's too large.
id,authors,date,event,title,type,abstract
709815,"Emmanuel Saez, University of California-Berkeley","Fri, August 15, 7:00 to 9:00pm, TBA",Opening Plenary Session. Hard Times: The Concentrations of Income and Wealth,Inequality and Opportunity in the United States,Plenary,
709816,"Thomas M. Shapiro, Brandeis University; Melvin L. Oliver, University of California-Santa Barbara","Fri, August 15, 7:00 to 9:00pm, TBA",Opening Plenary Session. Hard Times: The Concentrations of Income and Wealth,Black Wealth/White Wealth Revisited,Plenary,
709817,"Leslie McCall, Northwestern University","Fri, August 15, 7:00 to 9:00pm, TBA",Opening Plenary Session. Hard Times: The Concentrations of Income and Wealth,How Americans Think about Economic Inequality,Plenary,
710353,"Jay MacLeod, Parish of All Saints and Author","Sat, August 16, 12:30 to 2:10pm, TBA",Plenary Session. Social Class in Daily Life,Outclassed,Plenary,
710354,"Linda Marie Burton, Duke University","Sat, August 16, 12:30 to 2:10pm, TBA",Plenary Session. Social Cla
# sources:
# http://www.jgoodwin.net/?p=1223
# http://orgtheory.wordpress.com/2012/05/16/the-fragile-network-of-econ-soc-readings/
# http://nealcaren.web.unc.edu/a-sociology-citation-network/
# http://kieranhealy.org/blog/archives/2014/11/15/top-ten-by-decade/
# http://www.jgoodwin.net/lit-cites.png
###########################################################################
# This first section scrapes content from the Web of Science webpage. It takes
@kjhealy
kjhealy / z-automator.png
Created November 17, 2016 19:10 — forked from lrytz/z-automator.png
Shortcut for Syntax Highlighting in Keynote
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")