install termux from F-Droid.
apt update
function convertMiliseconds(miliseconds, format) { | |
var days, hours, minutes, seconds, total_hours, total_minutes, total_seconds; | |
total_seconds = parseInt(Math.floor(miliseconds / 1000)); | |
total_minutes = parseInt(Math.floor(total_seconds / 60)); | |
total_hours = parseInt(Math.floor(total_minutes / 60)); | |
days = parseInt(Math.floor(total_hours / 24)); | |
seconds = parseInt(total_seconds % 60); | |
minutes = parseInt(total_minutes % 60); |
<?php | |
file_put_contents( 'progress.txt', '' ); | |
$targetFile = fopen( 'testfile.iso', 'w' ); | |
$ch = curl_init( 'http://ftp.free.org/mirrors/releases.ubuntu-fr.org/11.04/ubuntu-11.04-desktop-i386-fr.iso' ); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); | |
curl_setopt( $ch, CURLOPT_NOPROGRESS, false ); | |
curl_setopt( $ch, CURLOPT_PROGRESSFUNCTION, 'progressCallback' ); | |
curl_setopt( $ch, CURLOPT_FILE, $targetFile ); |
<?php | |
//output buffer | |
ob_start(); | |
//create javascript progress bar | |
echo '<html><head> | |
<script type="text/javascript"> | |
function updateProgress(percentage) { | |
document.getElementById(\'progress\').value = percentage; | |
} |
<?php | |
set_time_limit(0); | |
ignore_user_abort(true); | |
$url = "http://web.shit/backup.zip"; | |
$ch = curl_init($url); | |
$to_file = 'web.zip'; | |
$opt = array(); | |
if(is_file($to_file)) | |
{ |
package com.amitaymolko.network; | |
import java.util.HashMap; | |
/** | |
* Created by amitaymolko on 2/16/16. | |
*/ | |
public class HttpRequest { |
/* | |
* @Module Timer | |
* @author : Micheal | |
* | |
* @usage: | |
$(document).ready(function() { | |
$(".s1").timer({ | |
from: 100, //sec | |
end: function() { | |
console.log('triggerd at the end of timer') |
/* | |
A (very) WIP collection of optimized/recommended jQuery plugin patterns | |
from @addyosmani, @cowboy, @ajpiano and others. | |
Disclaimer: | |
----------------------- | |
Whilst the end-goal of this gist is to provide a list of recommended patterns, this | |
is still very much a work-in-progress. I am not advocating the use of anything here | |
until we've had sufficient time to tweak and weed out what the most useful patterns |
<!-- via control upload --> | |
<input type="file" id="your-files" multiple> | |
<script> | |
var control = document.getElementById("your-files"); | |
control.addEventListener("change", function(event) { | |
// When the control has changed, there are new files | |
var i = 0, | |
files = control.files, |
This is a sample script for uploading files to Google Drive using Javascript. The files are uploaded by Drive API v3. gapi.client.drive.files.create()
can create an empty file on Google Drive. But it cannot directly upload files including contents. I think that this might not be able to upload files and metadata with the multipart/related, although this might be resolved by the future update. So now, as one of workarounds, I use using XMLHttpRequest.
In this sample script, a text file including contents is created under a folder.