BOOM Analytics: Exploring Data-Centric, Declarative Programming for the Cloud
This list of resources is all about acquring and processing aerial imagery. It's generally broken up in three ways: how to go about this in Photoshop/GIMP, using command-line tools, or in GIS software, depending what's most comfortable to you. Often these tools can be used in conjunction with each other.
- USGS Earth Explorer - Browser and data access (create a login)
http://earthexplorer.usgs.gov/
- Landsat archive
Part of a lesson for the Stanford Journalism Computational Methods in the Civic Sphere
This is a short tutorial on how to use command-line tools, including csvfix and t, the command-line Twitter interface, to access and parse data from the Sunlight Foundation and Twitter. The end goal of this exercise is to gather who everyone in Congress follows (friends, in the parlance of Twitter), and then count up the common friends to find out which Twitter accounts are most followed by members of Congress.
Here's a screenshot of the result, after it's been imported into [Google Spreadsheets](https://docs.google.com/spreadsheets/d/1cjRJyrPYj8KAhUrot8ubPOWgbAwm0OqIgPtsswJ2sjM/edit#gid=1358907576
I recently had several days of extremely frustrating experiences with service workers. Here are a few things I've since learned which would have made my life much easier but which isn't particularly obvious from most of the blog posts and videos I've seen.
I'll add to this list over time – suggested additions welcome in the comments or via twitter.com/rich_harris.
Chrome 51 has some pretty wild behaviour related to console.log
in service workers. Canary doesn't, and it has a load of really good service worker related stuff in devtools.
var multiCrowbar = (function() { | |
/* | |
* SVG Export | |
* converts html labels to svg text nodes | |
* will produce incorrect results when used with multi-line html texts | |
* | |
* Author: Gregor Aisch | |
* based on https://github.com/NYTimes/svg-crowbar/blob/gh-pages/svg-crowbar-2.js | |
*/ |
// Client-side parser for .npy files | |
// See the specification: http://docs.scipy.org/doc/numpy-dev/neps/npy-format.html | |
var NumpyLoader = (function () { | |
function asciiDecode(buf) { | |
return String.fromCharCode.apply(null, new Uint8Array(buf)); | |
} | |
function readUint16LE(buffer) { | |
var view = new DataView(buffer); | |
var val = view.getUint8(0); |
module.exports = { | |
server: '.', | |
files: [ | |
'*.html', | |
'src/*' | |
], | |
ui: false, | |
notify: false | |
}; |
# data from http://ec.europa.eu/eurostat/web/gisco/geodata/reference-data/population-distribution-demography/geostat | |
# Originally seen at http://spatial.ly/2014/08/population-lines/ | |
# So, this blew up on both Reddit and Twitter. Two bugs fixed (southern Spain was a mess, | |
# and some countries where missing -- measure twice, submit once, damnit), and two silly superflous lines removed after | |
# @hadleywickham pointed that out. Also, switched from geom_segment to geom_line. | |
# The result of the code below can be seen at http://imgur.com/ob8c8ph | |
library(tidyverse) |
# Using concaveman in R using V8 | |
concaveman <- function(d){ | |
library(V8) | |
ctx <- v8() | |
ctx$source('https://www.mapbox.com/bites/00222/concaveman-bundle.js') | |
jscode <- sprintf( | |
"var points = %s;var polygon = concaveman(points);", | |
jsonlite::toJSON(d, dataframe = 'values') | |
) | |
ctx$eval(jscode) |
const regl = require('regl')({ | |
extensions: 'OES_texture_float' | |
}) | |
const LAPLACIAN_SHADER = ` | |
vec4 laplacian (sampler2D img, vec2 id, float DX) { | |
return -texture2D(img, id) + 0.25 * ( | |
texture2D(img, id + DX * vec2(-1, 0)) | |
+ texture2D(img, id + DX * vec2(1, 0)) | |
+ texture2D(img, id + DX * vec2(0, -1)) |