Skip to content

Instantly share code, notes, and snippets.

View xavijam's full-sized avatar

Javier Álvarez Medina xavijam

View GitHub Profile
@xavijam
xavijam / .block
Last active November 20, 2017 16:36
My first CARTO.js map
license: mit
border: no
scrolling: yes
@xavijam
xavijam / gist:b026c8c50acfab4c8b56
Created September 14, 2015 10:07
CSScomb config for Atom
csscomb: {
"always-semicolon": true,
"color-case": "upper",
"block-indent": " ",
"color-shorthand": false,
"element-case": "lower",
"eof-newline": false,
"leading-zero": true,
"quotes": "single",
"space-before-colon": "",
@xavijam
xavijam / index.html
Last active August 29, 2015 14:21
Adding a tooltip to a layer
<!DOCTYPE html>
<html>
<head>
<title>Leaflet 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, .map_wrapper {
position: relative;
@xavijam
xavijam / index.html
Created May 21, 2015 16:47
Add tooltip to a visualization
<!DOCTYPE html>
<html>
<head>
<title>Create tooltip · 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%;
@xavijam
xavijam / index.html
Last active August 29, 2015 14:10
Displaying infowindow when ajax request is done
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="UTF-8">
<title></title>
<link rel="stylesheet" href="http://libs.cartodb.com/cartodb.js/v3/3.11/themes/css/cartodb.css" />
<script src="http://libs.cartocdn.com/cartodb.js/v3/3.11/cartodb.js"></script>
<style type="text/css">
html, body, #map {
height:100%;
@xavijam
xavijam / torque_agg.js
Last active August 29, 2015 14:10 — forked from javisantana/torque_agg.js
Torque aggregation function.
torque.providers.windshaft.prototype.aggregateByKey = function(callback) {
var url = this.templateUrl
.replace('{x}', 0)
.replace('{y}', 0)
.replace('{z}', 0)
.replace('{s}', 0)
var self = this;
var extra = this._extraParams();
torque.net.get( url, function (data) {
@xavijam
xavijam / index.html
Last active June 22, 2016 08:10
Close infowindow programatically
<!DOCTYPE html>
<html>
<head>
<title>Close infowindow programatically | 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%;
@xavijam
xavijam / index.html
Created October 14, 2014 21:12
Change layer properties from an infowindow link
<!DOCTYPE html>
<html>
<head>
<title>Change layer things from infowindow links | 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>
@xavijam
xavijam / index.html
Created October 14, 2014 10:05
Open an infowindow programatically
<!DOCTYPE html>
<html>
<head>
<title>Open infowindow programatically | 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%;
@xavijam
xavijam / index.html
Created September 10, 2014 07:50
Changing infowindow offset with CartoDB.js
<!DOCTYPE html>
<html>
<head>
<title>Custom infowindow 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" />