Skip to content

Instantly share code, notes, and snippets.

View andrewxhill's full-sized avatar

Andrew W. Hill andrewxhill

View GitHub Profile
@andrewxhill
andrewxhill / index.html
Created August 19, 2015 12:57
USPO map lives again!
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<title>CartoDB + Time</title>
<link rel="shortcut icon" href="http://cartodb.com/favicon/favicon_32x32.ico" />
<style>
html, body, #map {
@andrewxhill
andrewxhill / index.html
Created July 27, 2015 20:44
list all points at a point
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<!--Edit the title of the page-->
<title>CartoDB Point Clustering</title>
<meta name="description" content="">
<meta name="author" content="">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<link rel="stylesheet" href="http://libs.cartocdn.com/cartodb.js/v3/themes/css/cartodb.css" />
@andrewxhill
andrewxhill / description.md
Created June 23, 2015 18:34
How the Twitter Template works

Step 1, provide a viz.json

This is the obvious step. My template then just grabs the viz.json and reads some basic information from it, including username and tablename.

Step 2, set the bounds

Okay, this was a bit of guessql. So, it creates the grid and measures all the points in each cell. It then selects the most dense cells that account for the first 60% of records. It then uses those to create the bounding box for the map :)

SELECT the_geom 
@andrewxhill
andrewxhill / change_log.sql
Last active August 29, 2015 14:23
Create a table to store changes from any of your tables in a log table.
--
-- Create a table in your CartoDB editor called 'version_control'
-- Run the following SQL in your editor to create the needed columns
--
ALTER TABLE version_control ADD COLUMN data json;
ALTER TABLE version_control ADD COLUMN source_id integer;
ALTER TABLE version_control ADD COLUMN table_name text;
ALTER TABLE version_control ADD COLUMN tg_op text;
@andrewxhill
andrewxhill / app.js
Last active August 29, 2015 14:21
currency map
// NODE.JS app
// Harvest Yahoo Finance and update CartoDB
var express = require('express');
var app = express();
var http = require('http'),
https = require('https'),
querystring = require('querystring'),
Step = require('step'),
fs = require('fs');
@andrewxhill
andrewxhill / index.html
Created May 16, 2015 17:20
Quick POW map!
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<!--Edit the title of the page-->
<title>CartoDB Point Clustering</title>
<meta name="description" content="">
<meta name="author" content="">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<link rel="stylesheet" href="http://libs.cartocdn.com/cartodb.js/v3/themes/css/cartodb.css" />
@andrewxhill
andrewxhill / index.html
Created May 11, 2015 20:37
quick linear regression test
<!DOCTYPE html>
<html>
<head>
<title>Census Model</title>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<link rel="shortcut icon" href="http://cartodb.com/assets/favicon.ico" />
<style>
html, body, #map {
height: 100%;
@andrewxhill
andrewxhill / dp_tabledescriptions.txt
Created May 8, 2015 14:39
Census Tracts - 2010 Column Descriptions
Source: https://www.census.gov/geo/maps-data/data/tiger-data.html
ITEM STUB
DPSF1. SEX AND AGE [57]
Universe: Total population
DP0010001 Total:
DP0010002 Under 5 years
DP0010003 5 to 9 years
DP0010004 10 to 14 years
DP0010005 15 to 19 years
@andrewxhill
andrewxhill / README.md
Last active August 29, 2015 14:18 — forked from auremoser/README.md

This is a clone of Paul Ramsey's Placenames Map to give context to searches; a prototype of a popcorn.js for maps. It uses a few cobbled-together code samples. Function additions to the original script are commented in all-caps.

Objective

Make a map that lets you search for placenames, and then automates some research about what that name references via Wikipedia. For example, a search for "Cesar Chavez" will create a heatmap for places named after Cesar Chavez, as well as pull in some wikipedia details about that search string.

When disambiguation is necessary, it pulls the most relevant name and offers a link alternative to rectify errors. It also pulls in images and links! More info to be had in pramsey's "About" section for his map.