Skip to content

Instantly share code, notes, and snippets.

@stevenpollack
stevenpollack / Appfile
Created February 11, 2016 00:41
otto experiment with dairy queen
application {
name = "dairy-queen"
type = "python"
dependency {
source = "git::https://gist.github.com/2694a602beadee7f6a77.git"
}
}
/*
customization {
@stevenpollack
stevenpollack / .ottoid
Last active February 11, 2016 00:38
rethinkdb Appfile for Otto
590a1469-c01c-5d41-122f-3ca4e58180d2
DO NOT MODIFY OR DELETE THIS FILE!
This file should be checked in to version control. Do not ignore this file.
The first line is a unique UUID that represents the Appfile in this directory.
This UUID is used globally across your projects to identify this specific
Appfile. This UUID allows you to modify the name of an application, or have
duplicate application names without conflicting.
@stevenpollack
stevenpollack / init.d_jupyter-notebook
Last active February 10, 2016 11:26 — forked from lambdalisue/jupyterhub
A service (init.d) script for jupyter-notebook
#! /bin/sh
### BEGIN INIT INFO
# Provides: jupyter-notebook
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start jupyter-notebook
# Description: This file starts a jupyter-notebook session using config
# parameters specified in ~/.jupyter/jupyter_notebook_config.py
We can make this file beautiful and searchable if this error is corrected: Unclosed quoted field in line 10.
"package" "Published:" "Depends:" "Imports:" "Suggests:"
"QCApro" "2016-01-27" "R (≥ 3.2.2)" "lpSolve, utils" "QCA3 (≤ 0.0-7), QCAGUI (≤ 2.0), testthat (≤ 0.11.0)"
"QCA" "2016-01-27" "R (≥ 3.2.2)" "lpSolve, utils" "QCA3 (≤ 0.0-7), QCAGUI (≤ 2.0), testthat (≤ 0.11.0)"
"lsgl" "2015-09-19" "R (≥ 3.0.0), sglOptim (== 1.2.0), Matrix" "methods, utils, stats" NA
"msgl" "2015-09-19" "R (≥ 3.0.0), Matrix, sglOptim (== 1.2.0)" "methods, utils, stats" NA
"rplos" "2015-09-16" "ggplot2" "methods, utils, stats, httr, jsonlite, dplyr, plyr, lubridate, reshape2, whisker, solr (≤ 0.1.6)" "XML, testthat, roxygen2, knitr"
"CAvariants" "2015-09-11" "R (> 3.0.1), methods" NA NA
"RDML" "2015-07-22" "R (> 3.0.3)" "R6 (≥ 2.0.1), assertthat (≥ 0.1), XML (≥ 3.98-1.1), plyr (≥ 1.8.1), dplyr (≥ 0.4.1), tidyr (≥ 0.2.0), rlist (≥ 0.4)" "knitr, chipPCR, ggplot2"
"kineticF" "2015-06-04" "R (> 3.1.0)" "circular, lqmm, splancs, sp, plotrix, MASS" NA
"XLConnect" "2015-03-01" "R (≥ 2.10.0), XLConnectJars (== 0.2-9)" "methods, rJava" "RUnit, lat
@stevenpollack
stevenpollack / !README.MD
Last active February 28, 2024 00:56
A simple R package development best-practices-example

R package development "best practices"

The core of this tutorial gist lies in bestPracticesWalkThrough.R. Running assumes you have the following packages at versions equal (or above) those specified

library('devtools') # 1.9.1
library('testthat') # 0.11.0
library('stringr')  # 1.0.0
library('git2r') # 0.12.1
@stevenpollack
stevenpollack / RenderRMarkdown
Created March 27, 2015 15:44
Use Rscript to call the "rmarkdown" render function on currently open .rmd file
" have vimr-plugin call rmarkdown::render
function! RenderRMarkdown()
" set autoread to supress W11 warning:
" vim is going to complain about the rmd file already existing...
:set autoread
" get full file path via %:p
! Rscript -e "rmarkdown::render(commandArgs(TRUE)[2])" --args %:p
endfunction
" call RenderRMarkdown silently to suppress the "Press ENTER to continue" prompt
@stevenpollack
stevenpollack / isFuncS3Generic
Created March 22, 2014 19:13
check whether a function is an S3 Generic in R
isFuncS3Generic <- function(func) {
funcBody <- body(func)
sum(grepl(pattern="UseMethod", x=funcBody)) != 0
}
@stevenpollack
stevenpollack / hw2_prob2_snippet.R
Created February 24, 2014 18:20
Code to build (X' X)^{-1} for problem #2.
table_5.1 <- matrix(0, nrow=4, ncol=4)
column_names <- c("Pres", "Educ", "Inc", "%W")
upper_tri <- c(253618, 55326, 12513, 37748108, 8121410,
6534383460, 131909, 32281, 14093097, 187312)
table_5.1[upper.tri(table_5.1, diag=TRUE)] <- upper_tri
table_5.1[lower.tri(table_5.1)] <- t(table_5.1)[lower.tri(table_5.1)]
colnames(table_5.1) <- rownames(table_5.1) <- column_names