Skip to main content

Posts

Showing posts from January, 2018

Cordova errors meteor

/home/bird/Pictures/Screenshot from 2018-01-25 17-50-01.png /home/bird/Pictures/Screenshot from 2018-01-25 18-35-04.png /home/bird/Pictures/Screenshot from 2018-01-25 22-52-31.png /home/bird/Pictures/Screenshot from 2018-01-25 22-52-32.png /home/bird/Pictures/Screenshot from 2018-01-25 22-52-50.png /home/bird/Pictures/Screenshot from 2018-01-25 22-52-53.png /home/bird/Pictures/Screenshot from 2018-01-25 22-52-59.png /home/bird/Pictures/Screenshot from 2018-01-25 22-53-20.png /home/bird/Pictures/Screenshot from 2018-01-25 22-53-27.png

NgRok ROcks

https://dashboard.ngrok.com/get-started

Working code Image to base64

<?php header('Access-Control-Allow-Origin: *'); header('Access-Control-Allow-Methods: GET, POST, PATCH, PUT, DELETE, OPTIONS'); header('Access-Control-Allow-Headers: Origin, Content-Type, Access-Control-Allow-Headers,X-Auth-Token'); define('UPLOAD_DIR', './'); $image_code = $_POST['image']; // $image_parts = explode(";base64,", $_POST['image']); $image_parts = explode(";base64,", $image_code); $image_type_aux = explode("image/", $image_parts[0]); $image_type = $image_type_aux[1]; $image_base64 = base64_decode($image_parts[1]); $file = UPLOAD_DIR . uniqid() . '.png';  file_put_contents($file, $image_base64); //print_r($_POST)  ;  echo $file; ?>

Time Difference

 Template.messanging.helpers({   calculate_time_difference(a){     var dt = new Date(a);    var millis =    new Date().getTime() - dt.getTime() ;       var minutes = Math.floor(millis / 60000);   var seconds = ((millis % 60000) / 1000).toFixed(0);    var hours = (millis / (1000 * 60 * 60)).toFixed(1);  var days = (millis / (1000 * 60 * 60 * 24)).toFixed(1);    if(minutes<1 && seconds<10){     return 'Just now';   }else if(minutes <1 && seconds<59 ){     return seconds + 'seconds ago';    } else if(minutes>= 1 && minutes<=59) {     return minutes + ' minutes ago';   }else if(minutes>59 && hours<24){         if(Math.floor(hours) ==1){         return Math.floor(hours) + ' hour ago';         }else{         return Math.floor(hours) + ' hours ago';         }   }else if(hours>24){     if(Math.floor(days) == 1){     return Math.floor(days) +" day ago";     }e