Skip to content

Instantly share code, notes, and snippets.

View collei's full-sized avatar
💭
I may be slow to respond.

Collei Inc. collei

💭
I may be slow to respond.
View GitHub Profile
@collei
collei / JsonTextOutputter.php
Last active August 28, 2023 17:50
Code to pretty-output JSON to files
<?php
/**
* @class \JsonTextOutputter
* @author Kendall Hopkins @link https://stackoverflow.com/users/188044/kendall-hopkins
* @author George G @link https://stackoverflow.com/users/3172092/george-g
* @source https://stackoverflow.com/a/9776726/21986565
**/
class JsonTextOutputter
{
@collei
collei / filenameWithLevels.php
Last active June 2, 2023 17:15
Provides a simple manner to obtain a final portion of a file path with an optional desired number of folder levels.
/**
* Provides a simple manner to obtain a final portion of a file path
* with the desired number of parent folders, if any.
*
* @param string $path
* @param int $withFolderLevels = 0
* @param string|null $withSeparator = null
* @return string
*/
@collei
collei / ArrayTokenScanner.php
Created June 23, 2022 00:32
A class used to convert string representations of php arrays to a live array without using eval()
<?php
/**
* @author user1441149 from https://stackoverflow.com/
* @since 2015-06-14
* @link https://stackoverflow.com/a/30833466
* @link https://stackoverflow.com/questions/12212796/parse-string-as-array-in-php/30833466#30833466
*
* A class used to convert string representations of php arrays
@collei
collei / class.stream.php
Created June 2, 2022 18:22 — forked from jas-/class.stream.php
PHP stream handler w/ support for multiple files over PUT
<?php
/**
* stream - Handle raw input stream
*
* LICENSE: This source file is subject to version 3.01 of the GPL license
* that is available through the world-wide-web at the following URI:
* http://www.gnu.org/licenses/gpl.html. If you did not receive a copy of
* the GPL License and are unable to obtain it through the web, please
*