Skip to content

Instantly share code, notes, and snippets.

Avatar
🌍
Making the World a better place (cit.)

Paolo Rotolo paolorotolo

🌍
Making the World a better place (cit.)
View GitHub Profile
@paolorotolo
paolorotolo / SplitDateTime.java
Last active Sep 1, 2015
Split a DateTime string to get single elements
View SplitDateTime.java
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
// Use example:
// DateFormat inputFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm");
// SplitDateTime splitDateTime = new SplitDateTime("2015-09-01 14:05");
// timeEditText.setText(splitDateTime.getHour + ":" + splitDateTime.getMinute);
@paolorotolo
paolorotolo / wear-debug.sh
Created Dec 23, 2015
Connect and debug an Android Wear device
View wear-debug.sh
#!/bin/bash
adb forward tcp:4444 localabstract:/adb-hub
adb connect localhost:4444
View import-translations-github.sh
#!/usr/bin/env bash
if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
echo -e "Starting translation import\n"
#go to home and setup git
cd $HOME
git config --global user.email "glucosioproject@gmail.com"
git config --global user.name "Glucat"
#clone gh-pages branch
View gh_pages_alpha_channel.sh
#!/usr/bin/env bash
if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
echo -e "Starting to update gh-pages\n"
#copy data we're interested in to other place
mkdir $HOME/android/
mkdir $HOME/android/wear
cp -R app/build/outputs/apk/app-debug.apk $HOME/android/
cp -R wear/build/outputs/apk/wear-debug.apk $HOME/android/wear
@paolorotolo
paolorotolo / GlucoseConverter.java
Last active Feb 2, 2016
Glucose Conversion tools in Java
View GlucoseConverter.java
import java.math.BigDecimal;
import java.math.RoundingMode;
public class GlucoseConverter {
public class GlucoseConverter {
public int glucoseToMgDl(double mmolL){
// Mg/dL = mmol/L * 18
double converted = mmolL * 18;
return (int) converted;
}
View GoogleDriveBackup.java
/*
* Copyright (C) 2016 Glucosio Foundation
*
* This file is part of Glucosio.
*
* Glucosio is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* Glucosio is distributed in the hope that it will be useful,
View BackupActivity.java
/*
* Copyright (C) 2016 Glucosio Foundation
*
* This file is part of Glucosio.
*
* Glucosio is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* Glucosio is distributed in the hope that it will be useful,
View soci.m
numeroSoci = input('Quanto soci vuoi inserire?')
for i=1:numeroSoci
socio(i).nome= input('nome: ', 's')
socio(i).cognome=input('cognome: ', 's')
socio(i).cf=input('cf: ', 's')
socio(i).qs=input('qs: ', 's')
socio(i).ruolo=input('ruolo (AMM 1 - CONS 2 - SOCIO 3): ')
end
View media.m
faiScegliere();
function f = faiScegliere()
scelta = input('Metti input [1 media - 2 massimo e minimo - 3 potenza]: ');
if scelta == 1
disp(strcat('La media è:', int2str(media())))
elseif scelta == 2
disp('Massimo e minimo')
View voti.m
numeroVotanti = input('Quanti sono i votanti: ');
votoSi = 0;
votoNo = 0;
votoNonSo = 0;
nonVoto = 0;
for i=1:numeroVotanti
k = input('[1 - SÌ, 2 - NO, 3 - NON SO, 4 - NON RISPONDO]');
You can’t perform that action at this time.