A quick and dirty script to check out each commit of a writing project and find the word count of each Markdown file at that point in time. You might want to use this on a clone of your writing repository. NO WARRANTY EXPRESS OR IMPLIED.
Read a collection of CSV files into a single list object in R, and give each item in the list the name of the file from which it was read.
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/foundation/5.1.1/css/normalize.min.css"> | |
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/foundation/5.1.1/css/foundation.min.css"> | |
<script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script> | |
<style> | |
p { | |
font-size: 18px; |
An attribution function for R. Borrowed from Kieran Healy's code.
An example of using a matrix to find which cities are closest to one
another. The file distances-from-google.r
downloads some sample data
from Google's Distance Matrix API and converts it from a JSON object to
an R matrix. The file distance-matrix.r
creates a function to find the
closest city in each row of a distance matrix.
Results:
- New York is closest to Philadelphia
- Los Angeles is closest to Houston
A quicksort algorithm to demonstrate recursion. Adapted from Norman Matloff, The Art of R Programming (San Francisco: No Starch Press, 2011), 176.
library(dplyr) | |
library(reshape2) | |
library(stringr) | |
library(ggplot2) | |
library(RColorBrewer) | |
# options(stringsAsFactors = FALSE) | |
options("scipen"=100, "digits"=4) | |
salaries <- read.csv("faculty-salaries-2013-14.csv") |
Learning to create a reusable chart function for a scatter plot, following Mike Bostock's "Towards Reusable Charts." Also includes a random data generator.
" Convert pandoc buffer to HTML and copy to system clipboard | |
autocmd FileType pandoc nnoremap <buffer> <C-S-x> :write \| let @+ = system("pandoc -t html " . shellescape(expand("%:p")))<CR> |
# Convert text files in cp1252 with dos line endings to files in UTF-8 with | |
# Unix line endings | |
for file (*.txt) {iconv -f cp1252 -t utf-8 $file -o $file} | |
dos2unix *.txt |