This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Remove Facebook's external link tracking | |
// @description Removes redirection and the "click identifier" from external links on FBs | |
// @namespace https://gist.github.com/k-barton | |
// @match https://*.facebook.com/* | |
// @version 0.3.7 | |
// @grant unsafeWindow | |
// @run-at document-start | |
// ==/UserScript== | |
(function() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Remove Google's link tracking | |
// @description Removes onmousedown event from external Google links to allow direct links | |
// @namespace https://gist.github.com/k-barton | |
// @include http://*.google.* | |
// @include https://*.google.* | |
// @version 0.2.1 | |
// @grant unsafeWindow | |
// @run-at document-end | |
// ==/UserScript== |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### BUGS/JAGS helper functions | |
### Example usage: | |
# | |
## Define JAGS model (currently only `model` section | |
#mocode <- bugsmodel({ | |
# alpha ~ dunif(0, 1) | |
# for(i in 1:10) { | |
# beta[i] ~ dunif(0, 1) | |
# } | |
# }, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#' @param expr an \R expression to produce the plot content. | |
#' @param fig numeric of length 1 or 2. The proportion of the plotting region to | |
#' be taken as the subplot plotting region (horizontal, vertical). | |
#' @param pos subplot position as a keyword, including "top", "bottom", "left", | |
#' "right". Empty string for centered plot. | |
#' @param inset numeric of length 1 or 2, giving inset distance(s) from the | |
#' margins in inches. | |
subplot <- | |
function(expr, fig = .33, pos = "topleft", inset = c(0, 0)) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mapscale <- | |
function(mapunit, unitname = "km", pos = c("bottom", "left", "right", "top"), | |
width = 0.15, | |
style = c("line", "bar", "double"), | |
height = 0, n = 5, | |
fine.part = NULL, lab.below = FALSE, | |
cex = par("cex.axis") * par("cex"), | |
line.lab = 0.8, offx = 0.25, offy = offx, | |
tcl = par("tcl"), extreme.ticks = FALSE, | |
double.bar = FALSE, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# draws a line from point `x`, `y` to a text `label` located at `ly`, `ly`, | |
#' without overlapping the text area. | |
#' @example | |
#' plot(c(-1, 1), c(-1, 1), type = "n", ann = FALSE) | |
#' label.x <- .666 | |
#' label.y <- .123 | |
#' lab <- "multiline\nlabel" | |
#' cex <- 1.2345 | |
#' a <- seq(0, pi, length.out = 15) | |
#' connector.line(sin(a), cos(a), label.x, label.y, lab, cex = cex, pad = c(.02, .02)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#' @param nx,ny number of checkers horizontally and vertically | |
#' @param size size in inches, alternative way to specify number of checkers. | |
#' Ignored if `nx` or `ny` are given. | |
#' @param ratio numeric scalar, x/y ratio of checker side | |
#' @adj adjust numeric of length 1 or 2, adjusts horizontal and vertical alignment | |
#' of the checkerboard. Preferably within 0-1 range. | |
#' @param col1,col2 first and second colour for the checkers | |
#' @param add logical, if `TRUE` (the default) draws the checkerboard over the existing plot | |
checkers <- | |
function(nx = NULL, ny = NULL, size = NULL, ratio = 1, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bwplot <- | |
function(x, y, lower, upper, box.lower, box.upper, w = .25, boxw = 0.8, | |
names = NULL, xlab = NULL, ylab = NULL, main = NULL, | |
lty = par("lty"), lty.stap = lty, lty.vert = lty, lty.box = lty, | |
lwd = par("lwd"), | |
border = par("fg"), | |
col.box = "white", col.pt = par("fg"), | |
xlim, ylim, add = FALSE, ann = !add, axes = TRUE, | |
pch = par("pch"), cex = par("cex"), bg = par("bg")) { | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
weighted.histogram <- | |
function() { | |
cl <- match.call() | |
cl$w <- NULL | |
cl[[1L]] <- as.name("hist.default") | |
cl$plot <- FALSE | |
h <- eval.parent(cl) | |
f <- factor(findInterval(x, h$breaks, left.open = TRUE, | |
rightmost.closed = TRUE, | |
all.inside = TRUE), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#' @param \dots two or more `logLik` objects | |
lrt <- | |
function(...) { | |
logL <- list(...) | |
nmodels <- length(logL) | |
rval <- matrix(rep(NA, 5 * nmodels), ncol = 5) | |
colnames(rval) <- c("#Df", "LogLik", "Df", "Chisq", "Pr(>Chisq)") | |
rownames(rval) <- 1:nmodels | |
rval[, 1] <- as.numeric(sapply(logL, function(x) attr(x, "df"))) |
OlderNewer