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
//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
<?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\]\$ ' | |
;; |
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
/** | |
* Add the time zone offset to a data. | |
* | |
* | |
* @param {Date} data - The Date to transform. | |
*/ | |
function getDataWithOffset(data){ | |
var tzoffset = (new Date()).getTimezoneOffset() * 60000; | |
return new Date(data - tzoffset); |
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
#git config --global core.editor nano | |
git config --global user.name "" | |
git config --global user.email "" | |
git config --global alias.co checkout | |
git config --global alias.br branch | |
git config --global alias.ci commit | |
git config --global alias.st status | |
git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --" |
OlderNewer