Skip to content

Instantly share code, notes, and snippets.

@iriberri
iriberri / index.html
Last active August 31, 2015 08:38
Searchbox GMaps + CartoDB layer
<!DOCTYPE html>
<html>
<head>
<title>Gmaps example | CartoDB.js</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%;
@iriberri
iriberri / vis-options-cartodbjs
Created July 17, 2014 10:40
CartoDB.js visualisation options
<html>
<head>
<title>CartoDB.js</title>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<style>
html, body, #map {
height: 100%;
padding: 0;
margin: 0;
@iriberri
iriberri / index.html
Last active August 29, 2015 14:04
Leaflet control createLayer
<!DOCTYPE html>
<html>
<head>
<title>Leaflet control example | CartoDB.js</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%;
@iriberri
iriberri / npmimport
Last active August 29, 2015 14:05
CartoDB import API with NodeJS
with form-data npm package
var form = new FormData();form.append('file', fs.createReadStream(path.join(__dirname, '../automation/testCarto.csv')));//${PROTOCOL}://${CDB_USER}.cartodb.com/api/v1/imports/?api_key=${API_KEY}form.submit({ protocol: 'https:', host:'xxx.cartodb.com', path:'/api/v1/imports/?api_key=xxxxxxx', method: 'post'}, function(err, res) { console.log(res.statusCode); console.log(err); test.object(res); done();});
@iriberri
iriberri / torquecs.md
Last active August 29, 2015 14:06
Torque-color-size

Styling Torque maps in size and color

Introduction

Usually, you can style your maps with CartoCSS in an easy way by using constraints with the actual value of your columns.

#places[status="Sunny"] { marker-fill: #A6CEE3; }

@iriberri
iriberri / gist:799bfa2b278923e8d9d0
Created September 26, 2014 08:56
infowindow hidden
<!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"/>
<style>
html, body, #map {
height: 100%;
@iriberri
iriberri / index.html
Last active August 29, 2015 14:07
Customize time-slider via CSS
<!DOCTYPE html>
<html>
<head>
<title>Easy example | CartoDB.js</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 {
@iriberri
iriberri / index.html
Last active August 29, 2015 14:07
Extending Searchbox functionality
<!DOCTYPE html>
<html>
<head>
<title>Custom search example | CartoDB.js</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%; padding: 0; margin: 0 }</style>
<link rel="stylesheet" href="http://libs.cartocdn.com/cartodb.js/v3/themes/css/cartodb.css" />
@iriberri
iriberri / index.html
Last active August 29, 2015 14:09
Custom legend by CSS - CartoDB
<!DOCTYPE html>
<html>
<head>
<title>Example</title>
<link rel="stylesheet" href="http://libs.cartocdn.com/cartodb.js/v3/themes/css/cartodb.css" />
<!--Switch between the different themes changing the stylesheet below - light-theme.css |dark-theme.css -->
<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" />
@iriberri
iriberri / torquetime.js
Last active August 29, 2015 14:10
Getting time and steps from Torque
<script>
function main() {
var torqueLayer;
var url = 'http://sdsfdsfb-0e853d047bba/viz.json';
cartodb.createVis('map', url, {
search: false,
tiles_loader: true,
layer_selector: false,