Skip to content

Instantly share code, notes, and snippets.

View ffflabs's full-sized avatar

Felipe Figueroa ffflabs

View GitHub Profile
@ffflabs
ffflabs / comboboxvariation.js
Created August 4, 2012 23:49
jQuery UI Combobox Variation
(function($){
$.widget( "ui.combobox", $.ui.autocomplete,
{
options: {
/* override default values here */
minLength: 3,
/* the argument to pass to ajax to get the complete list */
ajaxGetAll: {get: "all"}
},
@ffflabs
ffflabs / github_oauth.php
Last active December 11, 2015 17:58
Auth tipo para comprobar que alguien pertenece a una organización. Se puede pegar en el config.inc.php de PHPMyadmin
<?php
$client_id = CLIENT_ID;
$redirect_url = REDIRECT_URL;
$client_secret=CLIENT_SECRET;
$organizacion=ORGANIZATION;
if( empty($_COOKIE[$organizacion]) || sha1($_COOKIE[$client_id].$cfg['blowfish_secret'])!=$_COOKIE[$organizacion]) {
@ffflabs
ffflabs / toggle_visualization.js
Created June 5, 2014 19:25
Toggle Visualization
jQuery('#datasets').on('click', '.toggle_visualizations', function () {
var thischeckbox = jQuery(this);
var ladata = thischeckbox.data();
var id_dataset = ladata.id_dataset;
var category = ladata.category;
globalmap[category] = globalmap[category] || {};
var DataSet = globalmap[category][id_dataset];
ladata.flag = thischeckbox.is(':checked');
DataSet.setOptions({
visible: ladata.flag
jQuery('#datasets').on('click', '.toggle_visualizations', function () {
var thischeckbox = jQuery(this);
var ladata = thischeckbox.data();
ladata.flag = thischeckbox.is(':checked');
DataSet.saveSetting({
visible: ladata.flag
});
Intercom('trackEvent', 'updateVisibility', ladata);
instaGIS.updateVisibility(ladata);
});
jQuery('#datasets').on('click', '.toggle_visualizations', function () {
var thischeckbox = jQuery(this);
var ladata = thischeckbox.data();
ladata.flag = thischeckbox.is(':checked');
DataSet.saveSetting({
visible: ladata.flag
});
instaGIS.trackEvent('updateVisibility', ladata, true);
});
globalmap.conn.on('trackedEvent', function (thisEvent) {
var ladata = thisEvent.event_details;
switch (thisEvent.event_name) {
case 'updateVisibility':
instaGIS.updateVisibility(ladata);
break;
}
});
@ffflabs
ffflabs / README.md
Last active August 29, 2015 14:03
D3 vs Google Data Projection

This example shows the county boundaries for Illinois. In red we see the google.maps.Data() layer in blue a D3.geo.path() with mercator projection.

The google data layer is an object which displays in the same canvas as any google overlay (polygons, markers, polylines, etc) while the D3.geo.path() shows up in an SVG container I overlap on top of the google container.

@ffflabs
ffflabs / README.md
Created July 7, 2014 02:47
Difference between D3 and Google Data layer for geoJSON projection

This example shows the county boundaries for Illinois. In red we see the google.maps.Data() layer in blue a D3.geo.path() with mercator projection.

The google data layer is an object which displays in the same canvas as any google overlay (polygons, markers, polylines, etc) while the D3.geo.path() shows up in an SVG container I overlap on top of the google container.

@ffflabs
ffflabs / README.md
Last active August 29, 2015 14:03
Click on your desired destination

Example: getting the user position with HTML5 Geolocation API, then using google maps to find a route to the desired clicked location.

@ffflabs
ffflabs / README.md
Last active August 29, 2015 14:04
Drawing markers from an array/json and attaching infowindows to them

Example:

Using a JS object to draw a collection of markers, taking the position and additional attributes from the object itself.

On each loop the marker is drawn, and it receives a click listener, which in turn opens an infowindow whose content is the markers properties, taken from the JS object.

Made as an example for Stack Overflow