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
function timing(duration) { | |
const slots = [] | |
duration = Math.ceil(duration) | |
while (duration > 59 && slots.length < 2) { | |
slots.push( (duration % 60).toString().padStart(2, '0')) | |
duration = Math.floor(duration / 60) | |
} | |
if( duration > 0 ) slots.push(duration); | |
return slots.reverse().join(':') | |
} |
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
function humanReadableSize(bytes) { | |
var sizes = ['b', 'Kb', 'MB', 'GB', 'TB'], | |
transformed = bytes, | |
/* | |
* The lowest measure is byte | |
*/ | |
index = 0; | |
/* | |
* Limits the conversion to managed sizes. | |
*/ |
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 | |
add_filter('request', 'myCustomRequest', 0); | |
function myCustomRequest($req){ | |
if(!is_admin()){ | |
/* | |
* In admin context we will ignore it | |
*/ | |
if(!isset($req['page'])){ | |
/* |
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
/** | |
* | |
* Check if the given date is valid | |
* @param string $date | |
* | |
* @param string $separator | |
* | |
* @param string $format defines the order which year month and day are in the $date string | |
* this string supports "d" for days "m" for month and "y" for year | |
* |
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
<html> | |
<head> | |
<script type="text/javascript"> | |
/** | |
* Submit the outerHTML of the given ElementId to an URL | |
* | |
* @param elementId: the ID of the Element which the HTML will be submitted. | |
* @param page: the url (relaitve to the current page or absolute) to the server page that will receive the html | |
* @param target (optional): the target of the form, leave it empty to sumbit the content to the same window. |