Skip to content

Instantly share code, notes, and snippets.

View proclamo-zz's full-sized avatar

Cristian Martin Mouat proclamo-zz

View GitHub Profile
@proclamo-zz
proclamo-zz / Consumer.java
Created October 13, 2016 08:19
Kinesis consumer java
public class Consumer implements IRecordProcessor {
private static final Log log = LogFactory.getLog(Consumer.class);
private static final long BACKOFF_TIME = 1000;
private Logger logger;
private Logger rawLogger;
private Gson gson;
private FileWritterProperties fileWritterProperties;
private String shardId;
@proclamo-zz
proclamo-zz / README.md
Created October 4, 2015 15:35
Drawing a dataset from CartoDB's API without geo tools

My first approach to resolve this problem was focusing in GIS theory. But I was stuck with some cases and I was sure there was another way plus simple. Finally, I applied image drawing techniques and all was good. The only GIS thing is the conversion latitude / longitude to x / y pixels. In this case, I use an equirectangular projection, but we can use another projection.

In this moment, the application fetch the whole dataset from CartoDB API (70 MB) in GeoJSON format, extracts the geometries, calculates the bounds geometries, calculates the scale with these bounds, and draws the polygons. I implemented the panning and an zoom system that needs improve. All this in 4 seconds.

There is few points for improve performance. In server calls side:

@proclamo-zz
proclamo-zz / datepicker.jsx
Created August 26, 2015 06:28
datepicker example
require('rc-calendar/assets/bootstrap.css');
var React = require('react');
var Calendar = require('rc-calendar');
var GregorianCalendar = require('gregorian-calendar');
var DatetimeFormat = require('gregorian-calendar-format');
var DatePicker = React.createClass({
getDefaultProps: function() {
return {
@proclamo-zz
proclamo-zz / README.md
Last active November 21, 2016 06:27
d3.js Mandelbrot's fractal experiment

Little experiment with fractals. One day I founded the Mandelbrot's algorithm and I wanted to play with. Now it is written with d3 painting on canvas, pixel to pixel. Maybe I will try others implementations to improve performance.

@proclamo-zz
proclamo-zz / README.md
Created August 25, 2014 14:14
Interactive linear regression test

The same example as previous test but in this case interactive. You can add points and view how automatically the chart is upgraded with new calculus of linear regression.

@proclamo-zz
proclamo-zz / README.md
Last active June 29, 2017 18:47
Lineal regression test with Math.js

A simple linear regression test with Math.js using normal equations solution (based on Coursera's Machine Learning Course). You can view the interpolated values moving the mouse over the calculated line.

Run "bower install" and watch the console output.

@proclamo-zz
proclamo-zz / README.md
Last active August 29, 2015 14:04
Labeling speed test

Simple test for labeling plugin. You can view some stats after press the button.

@proclamo-zz
proclamo-zz / README.md
Last active March 16, 2017 09:56
Automatic labeling v1

Please, open in the new window to view the full example

This is the first version of a d3 plugin for automatic labeling. I called it labeling.

Each overlapped label rotates until no more overlaps. If one label reach the last position there is three options:

  • scale( factor ): the label scales factor times and run again the algorithm. scale can be called multiple times with different parameters.
  • legend(): transforms the label into a number and builds an internally legend which can be returned with the getLegend() function.
  • remove(): the label is removed.
@proclamo-zz
proclamo-zz / README.md
Last active August 29, 2015 14:03
Automatic labeling experiment step 1

This is the first step in an experiment on the problem of automatic positioning of labels on a map. You can drag de central label "Hello" and move over the other labels and you will see how the overlapped labels automatically change their positions. The function is called multiple times on each drag event, but the idea is to call only once on to a map.

@proclamo-zz
proclamo-zz / README.md
Last active August 29, 2015 14:03
Crossmap, an experiment with crossfilter.js and d3.js maps

Please, open in a new window to see the full map.

This is the first of a serie of experiments with crossfilter.js and the power of d3.js for building massive data interactive maps. I called it crossmap.

This map is fed with this dataset from infochimps' datasets. This dataset contains a list of wikipedia articles, tagged and geolocated. My particular ETL process has extracted 5456 articles.

The map provides a brush component for select a region, and a list of grouped tags related to selection. This list is updated interactively as the brush selection changes. If you click in any tag from list, the related points in the map are remarked. If you moves the mouse over selecteds points you will see a link to related wikipedia article.

In a future experiment I will add zoom capability. I will experiment too with the performance charging t