⌘T | go to file |
⌘⌃P | go to project |
⌘R | go to methods |
⌃G | go to line |
⌘KB | toggle side bar |
⌘⇧P | command prompt |
This file contains hidden or 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
# Get a lat/lon value for each address | |
geocode.addr <- function(city, country) { | |
geo.url <- "http://maps.googleapis.com/maps/api/geocode/json?address=" | |
geo.text <- getURL(paste(geo.url, URLencode(paste(city, country, collapse="+")), "&sensor=false", sep="")) | |
geo.json <- fromJSON(geo.text) | |
if(geo.json$status == "OK"){ | |
return(geo.json$results[[1]]$geometry$location) | |
} | |
else{ |
This file contains hidden or 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
find: ([a-z]) (["])([a-z]) | |
replace: $1 \\$2$3 | |
find: ."" | |
replace: ./"" | |
find: ([a-z])(["]) ([a-z]) | |
replace: $1\\$2 $3 |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 => '[email protected]', |
- 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 hidden or 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
toInstall <- c("proxy") | |
if(doInstall){install.packages(toInstall, repos = "http://cran.us.r-project.org")} | |
lapply(toInstall, library, character.only = TRUE) | |
# kmeans++ center initialization algorithm | |
kMeansPP <- function(df, k, doPlot = TRUE){ | |
kCenters <- data.frame(matrix(NA, ncol = ncol(df), nrow = k)) | |
whichPoints <- rep(NA, k) | |
whichPoints[1] <- sample(1:nrow(df), 1) | |
kCenters[1, ] <- df[whichPoints[1], ] # Initial center |
This file contains hidden or 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 | |
set -o errexit | |
# Author: David Underhill | |
# Script to permanently delete files/folders from your git repository. To use | |
# it, cd to your repository's root and then run the script with a list of paths | |
# you want to delete, e.g., git-delete-history path1 path2 | |
# | |
# retrieved from: http://dound.com/2009/04/git-forever-remove-files-or-folders-from-history/ | |
# |
OlderNewer