This file contains hidden or 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
## | |
# Generated by multiple prompts and iterations to PHPStorm's JetBrains AI # | |
# with some personal modifications of error messages. # | |
# 2024-04-25 # | |
# @see php_syntax_check --help | |
## | |
function php_syntax_check() { | |
verbose=false | |
binary="php" | |
recursive=false |
This file contains hidden or 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
/** | |
* dirlist | |
* A program to list files in a directory with some information as fast as possible. | |
* Useful for directories with 500,000 files. | |
* | |
* @date 2023-10-23 | |
* @author relipse | |
*/ | |
#include <sys/stat.h> | |
#include <time.h> |
This file contains hidden or 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
/** | |
* Generate an array of English requirements from the html element validation | |
* @param $element | |
* @returns {*[]} | |
*/ | |
const generateRequirementsFromHtmlValidation = function($element){ | |
var min = null; | |
var max = null; | |
var minlength = null; | |
var maxlength = null; |
This file contains hidden or 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 | |
$opts = getopt('lhc:v::', ['convert:','loop','ls', 'help']); | |
$helpstr = <<<EOT | |
Slash will convert strings/paths with / to \ and vice versa. | |
ie. try | |
C:\\Users\\relipse\\AppData\\Local\\JetBrains\\Toolbox\\apps\\PhpStorm\\ch-0\\221.5080.224\\bin\\phpstorm64.exe | |
or | |
/c/path/to/file | |
php {$argv[0]} | |
Options: |
This file contains hidden or 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 | |
$opts = getopt('s:f:h', ['file:','string:','help']); | |
var_dump($opts); | |
$helpstr = <<<EOD | |
Description: Sum all the values given in either the file or string. | |
Usage: php {$argv[0]} OPTIONS | |
OPTIONS |
This file contains hidden or 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
#!/bin/bash | |
find -iname "*.php" -print0 | xargs -0 -n1 php -l 2>&1 |
This file contains hidden or 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 | |
$opts = getopt('bfsvd:n:h', ['break','silent','verbose','dir:','name:','files','help']); | |
$helpstr = <<<EOT | |
Find Folder will find folders named anything. | |
php {$argv[0]} --dir /path/to/search/for/folders -n=foobar | |
Options: | |
-d, --dir Specify directory to search (recursively). | |
-n, --name Search by folder name (-n=foobar). | |
-v, --verbose Turn Verbosity on | |
-s, --silent Make as silent as possible except final result. |
This file contains hidden or 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 | |
$date = $argv[1] ?? null; | |
$curdate = $argv[2] ?? 'now'; | |
if (empty($date)){ | |
die('Date: '.$date.' is invalid. Use first argument for date of birth and second argument for date to calculate from like:'. | |
"\nphp birthday.php \"Nov 1, 1984\" \"Mar 1, 2004\""."\n"); | |
} | |
try{ |
This file contains hidden or 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 strip_unsafe_fnchars($input){ | |
return str_replace(['#','|','`','+','@',':','"',"'",'!','$',' ','/','\\', | |
'?','*','>','<','{','}','%'],'', $input); | |
} |
NewerOlder