- Swap Control and Caps Lock in System Preferences -> Keyboard -> Modifier Keys
- Google Chrome http://www.google.com/chrome/
- iTerm2 http://www.iterm2.com/
- Oh my zsh https://github.com/robbyrussell/oh-my-zsh/
- XCode (from the mac app store)
- XCode command line tools (run XCode, go to Preferences -> Downloads -> Command Line Tools)
- Homebrew https://github.com/mxcl/homebrew/wiki/installation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/bin/bash | |
# run chmod +x THIS_GIST.sh | |
# configure for debian or ubuntu! debian has dependencies that ubuntu's libs will conflict with | |
# sources: | |
# http://cran.r-project.org/bin/linux/debian/ | |
# http://cran.r-project.org/bin/linux/ubuntu/README | |
# http://stackoverflow.com/questions/10255082/installing-r-from-cran-ubuntu-repository-no-public-key-error | |
clear |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Drawing a scatter plot of raster images | |
doInstall <- TRUE # Change to FALSE if you don't want packages installed. | |
toInstall <- c("png", "devtools", "MASS", "RCurl") | |
if(doInstall){install.packages(toInstall, repos = "http://cran.r-project.org")} | |
lapply(toInstall, library, character.only = TRUE) | |
# Some helper functions, lineFinder and makeTable | |
source_gist("818983") | |
source_gist("818986") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
classify_sentiment <- function(text){ | |
# install required pacakges | |
if (!require(sentiment)) { | |
install.packages('sentiment') | |
library('sentiment') | |
} | |
if (!require(Rstem)) { | |
install.packages('Rstem', repos = 'http://www.omegahat.org/R', type='source') | |
library('Rstem') | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# this feels weird, but there's some magic here. Ruby knows where 'rubygems' is without you having to explain it with an exact path. | |
require 'rubygems' | |
# now you can you just flat-out require ANY gem you have installed! like | |
require 'pony' | |
# all of the sudden you have this really cool ruby library called 'pony' in your application's object space! And you can do shit like this: | |
Pony.mail({ | |
:to => 'matt@cutt.com', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# this function takes an input numeric vector and | |
# partitions it into a set number of breaks | |
# it then assigns a color to each break via RColorBrewer | |
assignColors <- function(var, | |
n = 9, # number of colors / breaks | |
style = "jenks", # can be changed to other methods in "classIntervals" | |
pal = "RdYlBu", # Palettes from RColorBrewer | |
na_color ='#787878', # Color to give NA's | |
na_omit = FALSE, # Logical, argument above will be irrelevant if TRUE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'<meta property=\"og:url\" content=\"(http://www.kickstarter.com/projects/[0-9a-zA-Z-]+/[a-z0-9-]+)' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tryRRR <- | |
function ( | |
expr, | |
ARRR = TRUE, | |
lang = 'sp', | |
time = 10 | |
) | |
{ | |
setwd(getwd()) | |
require("lubridate") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# scrape with llply, handling errors | |
output <- llply(urls, function(url) { | |
out <- try(scrapeCast(url), TRUE) | |
if (class(out)=='try-error') { | |
out <- NULL | |
print(paste("error scraping" url)) | |
} else { | |
return(out) | |
} | |
}, .progress="text") |