Example of a CartoDB iframe in the Amp library
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
class RideFinderViewController: UIViewController { | |
... | |
override func viewDidAppear(_ animated: Bool) { | |
// this view indicates an intent to go someplace | |
super.viewDidAppear(animated) | |
// Get the user's likely destinations using the SetSDK | |
// For custom control of starting location, see: http://bit.ly/getDestinationV1 |
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
// departure subscription | |
SetSDK.instance.onDeparture(.home) { departure in | |
// on departure, predict their likely destination | |
if let destinations = SetSDK.instance.getDestination(fromLocation: departure.location, fromTimestamp: departure.date), let destination = destinations.first { | |
// Process the top destination predictions | |
} | |
} |
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
SetSDK.instance.onDeparture(.home) { departure in | |
// Turn off lights, kill the music, lock the doors | |
} |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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'}, |
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
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" |
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
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, |
A basic class that allows you to quickly generate static images from the CartoDB API using custom CartoCSS builders etc.
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
<!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> |