Skip to content

Instantly share code, notes, and snippets.

View kjhealy's full-sized avatar

Kieran Healy kjhealy

View GitHub Profile
@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 / st2binding
Created November 5, 2012 16:22
R and ST2's REPL. Keybinding Example
[
// Modified Sublime-REPL keybindings for an "R-friendly" set of shortcuts.
// Copy and paste this text into the Key Bindings - User (under Preferences menu).
// For more information, see http://tomschenkjr.net/2012/05/17/using-sublime-text-2-for-r/
// Executes a selection of text in REPL, latter only displays code and does not execute
{ "keys": ["super+shift+enter"], "command": "repl_transfer_current", "args": {"scope": "selection"}},
// I disabled this one
//{ "keys": ["super+shift+enter", "r"], "command": "repl_transfer_current", "args": {"scope": "selection", "action":"view_write"}},
@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 }))
@kjhealy
kjhealy / proxy
Created February 7, 2013 14:03
Set up an SSH SOCKS proxy from the command line.
#!/bin/bash
## (C) George Goulas, 2011
##
## Proxy service configuration script for OSX
##
## SETTINGS
##
# SOCKS PROXY PORT
PORT=8080
@kjhealy
kjhealy / .slate
Last active December 16, 2015 18:59
Slate config file
# Configs
config defaultToCurrentScreen true
config nudgePercentOf screenSize
config resizePercentOf screenSize
config secondsBetweenRepeat 0.1
config checkDefaultsOnLoad true
config windowHintsShowIcons true
config windowHintsIgnoreHiddenWindows false
#config windowHintsDuration 5
config windowHintsSpread true
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,
# 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