Skip to content

Instantly share code, notes, and snippets.

@rpietro
rpietro / knitr_chunk_template.rmd
Created July 26, 2013 19:20
knitr template with commonly used options
# options http://goo.gl/2JGwlX
Models
```{r, eval:TRUE, cache=TRUE, results=asis, warning=FALSE, error=TRUE, message=FALSE, include=FALSE, tidy=TRUE}
summary(cars)
```
Plots
```{r, fig.width=7, fig.height=6}
plot(cars)
@rpietro
rpietro / knitcitation_example.r
Created July 29, 2013 02:58
script to test multiple functions from knitcitations
# this gist contains code extracted straight from http://goo.gl/wvKPH , http://goo.gl/YFhU9
library(devtools)
install_github("knitcitations", "cboettig")
require(knitcitations)
setwd("~/Desktop")
#------------------------------------------------------------------------------
# grabbing reference using a DOI (digital object identifier), which is also available through pubmed's xml such as in <ELocationID EIdType="doi" ValidYN="Y">10.1371/journal.pone.0065291</ELocationID>
@rpietro
rpietro / dilligas_public_license
Created July 30, 2013 16:14
dilligas license
DO I LOOK LIKE I GIVE A SHIT PUBLIC LICENSE
Version 1, July 2013
Copyright (C) 2013 Sam Levy <[email protected]>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO I LOOK LIKE I GIVE A SHIT PUBLIC LICENSE
@rpietro
rpietro / dilligas_statement.md
Created July 30, 2013 16:19
A statement to be included in documents placed under the DILLIGAS public license

This document is licensed under the DILLIGAS public license, which allows you to freely copy and modify it for any purpose.

@rpietro
rpietro / simplified_dot_template.gv
Last active December 20, 2015 11:29
simplified dot template
digraph situated_schema {
name [color = red, style = filled]
rankdir=LR
"name" -> "name2"
}
@rpietro
rpietro / index.html
Created August 2, 2013 05:03
html5 boilerplate
<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title></title>
<meta name="description" content="">
@rpietro
rpietro / image_graphviz.gv
Last active December 20, 2015 17:08
script to insert an image file into a graphviz file (dot or neato)
digraph dot_image {
name1 [shape=box, style=filled, fillcolor=white, color=blue, label=<<TABLE border="0" cellborder="0"><TR><TD width="100" height="100" fixedsize="true"><IMG SRC="figure.jpg" scale="true"/></TD><td><font point-size="12">name1</font></td></TR></TABLE>>];
"name1" -> "name2"
}
@rpietro
rpietro / chrome_preview.sublime-build
Created August 7, 2013 02:38
Build system to preview HTML in Chrome. Replace "Google Chrome" by "Firefox" or "Safari" for other browsers. Place the file under /Users/your_user_name/Library/Application Support/Sublime Text 2/Packages/User . Haven't tested in Sublime Text 3
{
"cmd": ["open", "-a", "Google Chrome", "$file"]
}
@rpietro
rpietro / web_scraping.r
Created August 9, 2013 14:57
collection of web scraping scripts from multiple sources. sources are acknowledged at the top of each section
# source: http://goo.gl/bgiOgy
# Install the RCurl package if necessary
#install.packages("RCurl", dependencies = TRUE)
library("RCurl")
# Install the XML package if necessary
#install.packages("XML", dependencies = TRUE)
library("XML")
# Get first quarter archives
@rpietro
rpietro / dalgaard.r
Created August 13, 2013 12:10
Dalgaard's chapter on basic data management and graphics
install.packages("ISwR")
require("ISwR")
x <- rnorm(50)
mean(x)
sd(x)
var(x)
median(x)
quantile(x)
pvec <- seq(0,1,0.1)
pvec