This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Split an array in several sub-array by id. | |
*/ | |
var separeArrayById = function (data) { | |
var valueById = {}; | |
for (var i = 0; i < data.length; i++) { | |
if (!valueById.hasOwnProperty(data[i].id)) { | |
valueById[data[i].id] = data.filter(function (el) { | |
return el.id === data[i].id; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#MIT License | |
# | |
#Copyright (c) 2017 Daniele Andreis | |
#Permission is hereby granted, free of charge, to any person obtaining a copy | |
#of this software and associated documentation files (the "Software"), to deal | |
#in the Software without restriction, including without limitation the rights | |
#to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
#copies of the Software, and to permit persons to whom the Software is | |
#furnished to do so, subject to the following conditions: | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//collect marker already plotted on the map | |
var markers_already_show = []; | |
var max_n_markers = 30; | |
//icon for the marker | |
var myIcon = L.icon({ | |
iconUrl: 'img/myIcon.svg', | |
iconSize: [38, 43], | |
iconAnchor: [16, 37], | |
popupAnchor: [0, -28] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
*Create geojson | |
**/ | |
SELECT row_to_json(fc) FROM ( | |
SELECT 'FeatureCollection' As type, array_to_json(array_agg(f)) As features FROM | |
(SELECT 'Feature' As type,ST_AsGeoJSON(lg.the_geom, 4)::json As geometry , | |
row_to_json((SELECT l FROM (SELECT value_1,value_2,value_3) As l | |
)) As properties | |
FROM my_table As lg ) As f ) As fc; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
*Crea thumb. | |
*/ | |
function make_thumb($src, $dest,$type, $desired_width) { | |
try{ | |
if($type=="png"){ | |
$source_image =imagecreatefrompng($src); | |
$width = imagesx($source_image); | |
$height = imagesy($source_image); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library('ckanr') | |
ckanr_setup() | |
ckanr_setup(url = "http://dati.trentino.it") | |
#packageTrentoOD = package_list(as = "json") | |
packagesTrentoOD = package_list(as = "table", | |
offset = 0, | |
limit = 100) | |
summary(packagesTrentoOD) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
angular.module('doublefilter.example', []).controller('doubleFilterCtrl', function ($scope, $cordovaGeolocation) { | |
$scope.geom=new L.Point(12, 12); | |
$scope.items=[{"lat":10,"lng":5,"property1":"a"},{"lat":0,"lng":6,"property1":"a"},{"lat":14,"lng":5,"property1":"b"}]; | |
$scope.filterValue="a"; | |
}).filter("propertyFilter", function () { | |
return function (items, propertyValue) { | |
var filtered = []; | |
for (var i = 0; i < items.length; i++) { | |
if (items[i].hasOwnProperty("property1") && items[i].property1 == propertyValue) { | |
filtered.push(items[i]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use myAppNameSpace\App; | |
use Slim\Http\Environment; | |
use Slim\Http\Request; | |
/** | |
* Description of ExampeSlimTest | |
* | |
* @author daniele andreis |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
A collection of method to manipulate string object in python. | |
The str object is a sequence, other example of sequence are: bytes, bytesarray, list, tuple, range | |
''' | |
def loToUpAndUpToLo(inputString): | |
''' | |
Switch the lowercase character to uppercase and uppercase to lowercase. | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ -x /usr/bin/lesspipe ] && eval "$(lesspipe)" | |
# | |
if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then | |
debian_chroot=$(cat /etc/debian_chroot) | |
fi | |
# | |
case "$TERM" in | |
xterm-color) | |
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' | |
;; |
OlderNewer