Skip to content

Instantly share code, notes, and snippets.

View epijim's full-sized avatar

James Black epijim

View GitHub Profile
@thomasingalls
thomasingalls / readme.md
Last active October 6, 2017 03:54
Use Rmarkdown with Python virtualenv

Motivation

Knitr beats the socks off of an iPython notebook. Both tools do the same job, but knitr doesn't require you to leave your established text editor workflow.

How to: Rmarkdown with Python virtualenv, for reproducibility.

Tested specifically on OS X 10.9, with R 3.1.2 and Anaconda python distribution.

  1. Calling an R script from the terminal will use the python version currently in the system PATH. If you need to specify a python 3.x or python 2.x environment, make your life easier and do it from the command line before you do anything else.
@iani
iani / jekyll-google-calendar
Created February 9, 2014 22:09
Embed google calendar in a web page for rendering by Jekyll. Copied from: https://github.com/StevenBlack/qst-jekyll-bootstrap/blob/master/calendar.html see it in action here: http://www.queenssailing.ca/calendar/
---
layout: page
title: Queen's Sailing Calendar
permalink: /calendar/
type: info
header_text: Queen's Sailing Calendar
calendar: true
---
<div class="span3">
<h3>List of 2013 Events</h3>
@psychemedia
psychemedia / index-template.html
Last active November 29, 2020 15:38
Motionchart for R: Template is in this gist as: rchart_template.html Example R in this gist as: rchart_motionchart.R
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Motion Chart</title>
<style>
/*@import url(../style.css?20120427);*/
#chart {
@mbjoseph
mbjoseph / vioplot2.R
Last active December 9, 2020 17:06
Slight change to the vioplot function from Daniel Adler that plots median lines instead of points, and gives the option to plot either side of a violin rather than always both.
vioplot2 <- function (x, ..., range = 1.5, h = NULL, ylim = NULL, names = NULL,
horizontal = FALSE, col = "magenta", border = "black", lty = 1,
lwd = 1, rectCol = "black", colMed = "white", pchMed = 19,
at, add = FALSE, wex = 1, drawRect = TRUE, side="both")
{
datas <- list(x, ...)
n <- length(datas)
if (missing(at))
at <- 1:n
upper <- vector(mode = "numeric", length = n)
@geotheory
geotheory / 3d_mapping
Last active July 1, 2021 18:01
Plotting 3D maps using OpenStreetMap and RGL.
# Plotting 3D maps using OpenStreetMap and RGL. For info see:
# http://geotheory.co.uk/blog/2013/04/26/plotting-3d-maps-with-rgl/
map3d <- function(map, ...){
if(length(map$tiles)!=1){stop("multiple tiles not implemented") }
nx = map$tiles[[1]]$xres
ny = map$tiles[[1]]$yres
xmin = map$tiles[[1]]$bbox$p1[1]
xmax = map$tiles[[1]]$bbox$p2[1]
ymin = map$tiles[[1]]$bbox$p1[2]