Skip to content

Instantly share code, notes, and snippets.

View ProjectOrangeBox's full-sized avatar
👨‍💻
Open to Opportunities

Don Myers ProjectOrangeBox

👨‍💻
Open to Opportunities
  • Philadelphia, Pa
View GitHub Profile
<?php
/**
*
* This content is released under the MIT License (MIT)
*
* @author Don Myers
* @license http://opensource.org/licenses/MIT MIT License
* @link https://github.com/ProjectOrangeBox
*/
@ProjectOrangeBox
ProjectOrangeBox / disc.php
Last active July 7, 2022 23:21
PHP File System Wrapper DISC
<?php
declare(strict_types=1);
/**
* File System Functions
*
* File System Abstraction which automatically
* works in a given root path
*
<?php
class readCsv implements Iterator
{
const ROW_SIZE = 8192;
protected $handle = NULL;
protected $currentRow = NULL;
protected $rowCounter = NULL;
protected $hasHeader = null;
@ProjectOrangeBox
ProjectOrangeBox / Install Node and Gulp
Created April 30, 2021 17:51
CSS / JS / PUG Gulp files for standard PHP project
Install Gulp
https://nodejs.org/en/
* Install Node
Node.js v12.16.1 to /usr/local/bin/node
npm v6.13.4 to /usr/local/bin/npm
<?php
function table(string $filename): array
{
$fp = fopen($filename, 'r');
if ($fp === false) {
die('could not open file' . chr(10));
}
@ProjectOrangeBox
ProjectOrangeBox / base62.php
Last active April 12, 2021 11:33
base 62 encode / decode
function base62_encode($num) {
$b = 62;
$base = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
$r = $num % $b ;
$res = $base[$r];
$q = floor($num/$b);
while ($q) {
$r = $q % $b;
$q = floor($q/$b);
Bash Shell Find Out If a Variable Is Empty Or Not
Let us see syntax and examples in details. The syntax is as follows for if command:
if [ -z "$var" ]
then
echo "\$var is empty"
else
echo "\$var is NOT empty"
fi
OR
@ProjectOrangeBox
ProjectOrangeBox / PHP CleanUp Class
Last active June 11, 2020 17:22
Clean up files in a folder based on regular expression and days as well as database table based on datetime stamp
<?php
class cleanUp
{
static public function folder(string $folder, string $fileRegEx, int $days, bool $recusive = true): int
{
$count = 0;
if (!\FS::file_exists($folder)) {
throw new \Exception('Folder "' . $folder . '" not found.');
@ProjectOrangeBox
ProjectOrangeBox / PHP FS
Last active June 29, 2022 18:41
File System Wrappers based on ROOT folder
<?php
/**
* File System Functions
*
* File System Abstraction which automatically
* works in a given root path
*
* Can be added with composer by adding a composer.json file with:
*
@ProjectOrangeBox
ProjectOrangeBox / config.ini
Last active September 15, 2022 17:28
bin scripts including shelly and config
#!/bin/bash
OWNER="drpepper"
GROUP="administrators"
PUBLICDIRECTORY=""
# used by crontab
MAXLOGAGE="7 days"
MAXLOCKAGE="4 hours"