Skip to content

Instantly share code, notes, and snippets.

Andrew W. Hill andrewxhill

Block or report user

Report or block andrewxhill

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View onDeparture.swift
SetSDK.instance.onDeparture(.home) { departure in
// Turn off lights, kill the music, lock the doors
}
@andrewxhill
andrewxhill / Small Multiples.ipynb
Last active Jun 25, 2016
Create small multiples through the Static Maps API
View Small Multiples.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@andrewxhill
andrewxhill / batchAPI.py
Last active May 16, 2018
quick example of using the batch api over python
View batchAPI.py
import sys
import urllib
import urllib2
import json
import requests
# Start a new batch SQL task
def cartoBatchQuery(username, api_key, sql):
r = requests.post('http://%s.cartodb.com/api/v2/sql/job?api_key=%s' %(username,api_key),
headers={'content-type':'application/json'},
@andrewxhill
andrewxhill / static_map.py
Created Apr 14, 2016
Get a static map from a viz.json using python
View static_map.py
import sys
import urllib
import urllib2
import json
import requests
basemap = {
"type": "http",
"options": {
"urlTemplate": "http://{s}.basemaps.cartocdn.com/dark_nolabels/{z}/{x}/{y}.png"
@andrewxhill
andrewxhill / README.md
Created Mar 18, 2016
Example of a CartoDB iframe in the Amp library
View README.md

Example of a CartoDB iframe in the Amp library

@andrewxhill
andrewxhill / minimum_spanning_tree.sql
Created Mar 13, 2016
Minimum spanning tree in SQL... just because
View minimum_spanning_tree.sql
CREATE TYPE minimum_spanning_tree_internal AS (
d NUMERIC[],
a INT[],
b INT[],
geoms GEOMETRY[],
ids TEXT[]
);
CREATE TYPE minimum_spanning_tree_unit AS (
d NUMERIC,
@andrewxhill
andrewxhill / README.md
Created Jan 28, 2016
Static Image Generator Example
View README.md

A basic class that allows you to quickly generate static images from the CartoDB API using custom CartoCSS builders etc.

@andrewxhill
andrewxhill / index.html
Created Nov 10, 2015
fixed election map
View index.html
<!DOCTYPE html>
<html>
<head>
<title>Election Mapping Bonanza</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" />
<link href='https://fonts.googleapis.com/css?family=Open+Sans:400,300,700|Open+Sans+Condensed:300,700' rel='stylesheet' type='text/css'>
<style>
@andrewxhill
andrewxhill / suncalc.sql
Last active Sep 14, 2016
Test of SunCalc in SQL
View suncalc.sql
-- Test of porting SunCalc to SQL
-- Original SunCalc https://github.com/mourner/suncalc
-- Original SunCalc License https://github.com/mourner/suncalc/blob/master/LICENSE
CREATE TYPE suncalc_position AS (
azimuth decimal,
altitude decimal
);
CREATE TYPE suncalc_coords AS (
declination decimal,
rightAscension decimal
@andrewxhill
andrewxhill / yahoo.py
Created Sep 18, 2015
Use yahoo string geolocation api and drop results into cartodb
View yahoo.py
#!/usr/bin/env python
import string
import sys
import urllib
import urllib2
#Uses Yahoo Placemaker and the python-placemaker library
from placemaker import placemaker
You can’t perform that action at this time.