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
/* | |
* parameter: a string with a possible date | |
* returns: false if it can't decode, otherwise an object like the following: | |
* {type, hour, minute, second, year, month, day} | |
* 'type' is the numeric index of the format that the string was guessed from. | |
*/ | |
function parseDate(v) { | |
/* | |
* Every one of those options belo is a valid entry for the 'v' argument | |
* If some information is missing, it usually is replaced by current date info |
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 | |
function search_recursively_for_extension($directory, &$array, $extension=".dat") { | |
//global $debug; | |
if (substr($directory, -1) === "/" || substr($directory, -1) === "\\") { | |
$directory = substr($directory, strlen($directory)-1); | |
} | |
$nodes = scandir($directory); | |
//$debug .= ("Reading Directory: ".$directory."\n").(($nodes === false || $nodes === NULL)?("false, ".(file_exists($directory)?"it does exist":"it doesn't even exist")."\n"):(var_export($nodes, true)."\n")); | |
if (is_array($nodes)) { | |
foreach ($nodes as $node) { |
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 c program to search all files recursively from the executable's path and retrieve its relative filename and last modified date. | |
// Similar to 'ls' command on linux | |
/* Sample output: | |
This directory tree has 3 files: | |
2017-12-05 23:55:39 ./src/recursive_file_list.c | |
2017-12-05 23:52:17 ./recursive_file_list.exe | |
2017-12-05 23:51:17 ./tools/windows/compile.bat | |
*/ |
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
/* | |
* Applicable to strings which would go inside a style property of an element, like so: | |
* element.setAttribute("style",minifyStyle(`margin : 0px 5px 4px 10px;`)); // This would remove 4 unnecessary spaces from the string | |
*/ | |
const minifyStyle = (s, mode=0) => s.replace(/(\r\n|\t|\n|\r)/gm,"").split('').filter((char, index) => (((((mode == 1)&&(mode = 2))||true)&&(((char == ':')&&(mode = 1))||true)&&(char == ';')&&(mode = 0)||true)&&mode == 0)?(char !== ' '):((mode == 2)?((mode = 3)&&(char != ' ')):true)).join(''); | |
minifyStyle(`margin-top: 5px; | |
margin: 5px 5px 5px 6px; | |
background-image: url(...) center center no-repeat; |
NewerOlder