This file contains hidden or 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
| $ node test.js | |
| Express app started on port 3000 | |
| Uploading: %1 | |
| /Users/bryce/Projects/app/test.js:30 | |
| next(err); | |
| ^ | |
| TypeError: object is not a function | |
| at Object.CALL_NON_FUNCTION (native) | |
| at /Users/bryce/Projects/app/test.js:30:7 | |
| at IncomingForm.<anonymous> (/Users/bryce/.node_libraries/.npm/formidable/0.9.11/package/lib/formidable/incoming_form.js:96:9) |
This file contains hidden or 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
| #IfWinActive Terraria: | |
| #MaxThreadsPerHotkey 3 | |
| $F1:: | |
| #MaxThreadsPerHotkey 1 | |
| if ClickSpam | |
| { | |
| ClickSpam := false | |
| return | |
| } | |
| ClickSpam := true |
This file contains hidden or 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
| library(ggplot2) | |
| theme_set(theme_bw(base_size=18)) | |
| anscombe_m <- data.frame() | |
| for(i in 1:4) | |
| anscombe_m <- rbind(anscombe_m, data.frame(set=i, x=anscombe[,i], y=anscombe[,i+4])) | |
| ggplot(anscombe_m, aes(x, y)) + geom_point(size=5, color="red", fill="orange", shape=21) + geom_smooth(method="lm", fill=NA, fullrange=TRUE) + facet_wrap(~set, ncol=2) |
This file contains hidden or 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
| setwd("~/src/amoeba.github.io/") | |
| # Ensure we're in a Jekyll folder | |
| # Do this by ensuring there's a _posts folder | |
| if(!("_posts" %in% list.files(".", "*"))) | |
| { | |
| cat("This script is not being run from a Jekyll blog directory.\n") | |
| cat("Change directories and re-run.\n") | |
| quit() | |
| } |
This file contains hidden or 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
| task :knit do | |
| sh "Rscript knit-all.r" | |
| end | |
| task :knitall do | |
| sh "Rscript knit-all.r --all" | |
| end | |
| task :build => [:knit] do | |
| sh "bundle exec jekyll build" |
This file contains hidden or 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
| # hexclock | |
| # after http://www.jacopocolo.com/hexclock/ | |
| # written by Bryce Mecum (@brycem) | |
| while(TRUE) | |
| { | |
| hextime <- paste0("#", format(Sys.time(), "%I%M%S")) | |
| plot(NA, xlim=c(0,1), ylim=c(0,1), axes=F, xlab="", ylab="") | |
| rect(0, 0, 1, 1, col=hextime) |
This file contains hidden or 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
| library("ggplot2") | |
| library("animation") | |
| saveGIF({ | |
| for(shadyside in 1:39) | |
| { | |
| sides <- c("Sky", "Sunny side of pyramid", "Shady side of pyramid") | |
| amounts <- c(150, 40 - shadyside, shadyside) | |
This file contains hidden or 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
| <!DOCTYPE html> | |
| <meta charset="utf-8"> | |
| <h1>Random Trees</h1> | |
| <p>Written by <a href="http://brycemecum.com/">Bryce Mecum</a></p> | |
| <p>Code adapted from <a href="http://www.jasondavies.com/">Jason Davies</a> for generating right-angled trees and <a href="https://github.com/yuanyan/">yuanyan</a> for the Poisson distribution code.</p> | |
| <p> | |
| <button id="start" onclick="start()">Start</button> | |
| <button id="stop" onclick="stop()">Stop</button> | |
| </p> |
This file contains hidden or 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
| Note: These instructions assume the extent is -180 - 180, and -90 - 90. Use gdalinfo to check beforehand. They also assume our spatial file is longlat-projected. | |
| For raster: | |
| 1. Grab a raster file | |
| 2. Decide upon how we'd like to trim. Below, we trim to -180:-120x30:90 and then 120:180x30:90 | |
| 2. Trim: gdalwarp -te -180 30 -120 90 {SPATIAL_FILE_PATH} {OUTPUT_FILE_PATH} | |
| 3. Trim: gdalwarp -te 120 30 180 90 {SPATIAL_FILE_PATH} {OUTPUT_FILE_PATH} | |
| 4. Reproject: gdaltransform -s_srs '+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs' -t_srs '+proj=longlat +ellps=WGS84 +pm=360 +datum=WGS84 +no_defs' |
This file contains hidden or 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
| # ggplot2 example | |
| # Show how geom_line() does not connect the line through NA values | |
| library(ggplot2) | |
| # Make some fake data | |
| mydata <- data.frame(x = 2000:2010, y = rnorm(11, 5, 2)) | |
| # First plot, all lines are connected correctly | |
| ggplot(mydata, aes(x, y)) + geom_line() |