Skip to content

Instantly share code, notes, and snippets.

View walkerke's full-sized avatar

Kyle Walker walkerke

View GitHub Profile
@auremoser
auremoser / nicar_15_mappingjs.md
Last active August 29, 2015 14:16
NICAR 15 - Workshop

Mapping JS: Building narrative with geo data + CartoDB

Aurelia Moser, Map Scientist, CartoDB Workshop - NICAR Session Link

March 6, 2015, 3:20PM-4:20PM

Find this document here:

  • Stackedit:
@andy-esch
andy-esch / sql.sql
Last active May 7, 2019 17:30
Move Alaska and Hawaii under AZ/NM
-- Convert your states (or other geometries id'd by state) to
-- display as with Alaska, Hawaii, and Puerto Rico transcaled
--
-- @param g: input geometry
-- @param state: column identifying the state (name, postal abbreviation, state FP)
--
-- output: geometries of states in albers projections of the states
--
-- Projections:
@timelyportfolio
timelyportfolio / code.R
Last active July 9, 2021 18:52
R | Turf.js with V8
#devtools::install("jeroenooms/V8")
library("V8")
library(pipeR)
ct = new_context("window")
# min.js gives me a call stack size error but non-min works fine
ct$source(
"https://raw.githubusercontent.com/morganherlocker/turf/master/turf.js"
)
# one of the examples from turf API docs
@bchartoff
bchartoff / oldfaithful
Created December 10, 2013 22:21
Code to create multi axis plots in Plotly
#combine elements with same name in two named lists (useful for combining layouts)
appendList <- function (x, val)
{
stopifnot(is.list(x), is.list(val))
xnames <- names(x)
for (v in names(val)) {
x[[v]] <- if (v %in% xnames && is.list(x[[v]]) && is.list(val[[v]]))
appendList(x[[v]], val[[v]])
else c(x[[v]], val[[v]])
}
@kylebgorman
kylebgorman / autoloess.R
Last active November 28, 2022 16:06
autoloess.R: set the "span" (smoothing) hyperparameter for a LOESS curve so as to minimize AIC_c (includes a cute demonstration)
# autoloess.R: compute loess metaparameters automatically
# Kyle Gorman <gormanky@ohsu.edu>
aicc.loess <- function(fit) {
# compute AIC_C for a LOESS fit, from:
#
# Hurvich, C.M., Simonoff, J.S., and Tsai, C. L. 1998. Smoothing
# parameter selection in nonparametric regression using an improved
# Akaike Information Criterion. Journal of the Royal Statistical
# Society B 60: 271–293.
@wboykinm
wboykinm / index.html
Last active October 13, 2015 18:08
CartoDB Custom Infowindow
<!DOCTYPE html>
<html>
<head>
<style>
html, body, #map {
height: 100%;
padding: 0;
margin: 0;
}
</style>