Skip to content

Instantly share code, notes, and snippets.

View ramiroaznar's full-sized avatar

Ramiro Aznar ramiroaznar

View GitHub Profile
@ramiroaznar
ramiroaznar / index.html
Last active January 14, 2024 15:53
CARTO.js + Highchart.js
<!DOCTYPE html>
<html>
<head>
<title>CARTO.js + Highchart.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" />
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>
@ramiroaznar
ramiroaznar / AnimatedMarker.js
Last active October 11, 2023 15:37
How to make your markers move with Leaflet.js
L.AnimatedMarker = L.Marker.extend({
options: {
// meters
distance: 200,
// ms
interval: 1000,
// animate on add?
autoStart: true,
// callback onend
onEnd: function(){},
@ramiroaznar
ramiroaznar / readme.md
Last active August 2, 2023 12:19
TURBO CARTO - The good, the handsome and the turbo.
@ramiroaznar
ramiroaznar / README.md
Last active January 24, 2023 15:39
Adding or moving markers on a Leaflet map

The map is set to drag the marker and get its new location with a popup. Uncomment from line 32 to 39, and comment line 41 to 51 in order to see how to add markers on click.

@ramiroaznar
ramiroaznar / index.html
Last active September 30, 2022 02:36
How to create an interactive heatmap with Leaflet.js
<html>
<head>
<title>How to create an interactive heatmap with Leaflet.js</title>
<meta charset="utf-8">
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet/v0.7.7/leaflet.css" />
<script src="http://cdn.leafletjs.com/leaflet/v0.7.7/leaflet.js"></script>
<script src="leaflet-heat.js"></script>
<style type="text/css">
html, body, #map{
height: 100%;
@ramiroaznar
ramiroaznar / test_is_in_null_island.sql
Created July 1, 2022 09:19
dbt spatial test macros
{% test is_in_null_island(model, column_name) %}
with validation as (
select
st_x({{ column_name }}) as lng,
st_y({{ column_name }}) as lat
from
{{ model }}
@ramiroaznar
ramiroaznar / index.html
Last active May 20, 2022 16:34
Interaction and styling GeoJSON with Leaflet.js
<html>
<head>
<title>Interaction and styling GeoJSON with Leaflet.js</title>
<meta charset="utf-8">
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet/v0.7.7/leaflet.css" />
<script src="http://cdn.leafletjs.com/leaflet/v0.7.7/leaflet.js"></script>
<style type="text/css">
html, body, #map{
height: 100%;
padding: 0;
@ramiroaznar
ramiroaznar / created_dbt_project.py
Last active February 22, 2022 14:56
Create a dbt project from a project name and a list of data model names
import os
import click
import logging
import time
# create a logger function
def get_logger():
logging.basicConfig(
level=logging.INFO,
@ramiroaznar
ramiroaznar / README.md
Last active November 26, 2021 22:08
ramiroaznar meta gist

Meta Gist

  • PostgreSQL and PostGIS queries
  • CartoCSS styles
  • CARTO.js blocks
  • DI.js blocks
  • Leaflet.js blocks
  • Other blocks
  • Others
@ramiroaznar
ramiroaznar / query.sql
Created August 12, 2016 12:17
How to find duplicate values with PostgreSQL
select * from table t1
where (select count(*) from table t2
where t1.field = t2.field) > 1
order by field