Skip to content

Instantly share code, notes, and snippets.


Dennis Jungbauer d4rkne55

  • Germany
View GitHub Profile
d4rkne55 / Time.class.php
Last active Jul 16, 2020
Class for working with time data/durations only
View Time.class.php
class Time
public $h;
public $i;
public $s;
public $f;
private static $unitData = array(
d4rkne55 / JsonDumper.class.php
Created Sep 20, 2019
Class for dumping/beautifying JSON
View JsonDumper.class.php
class JsonDumper
/** @var string */
private $json;
/** @var int spaces to use for one indentation level */
private $indentation;
d4rkne55 / AsciiTable.class.php
Created Sep 20, 2019
Class for drawing cool ASCII tables, including data
View AsciiTable.class.php
class AsciiTable
private $rows;
private $columns;
private $headers = array();
private $data = array();
private $separators;
private $headerPadMethod;
d4rkne55 / NumberSpell.class.php
Last active Sep 21, 2019
Class for getting the spelled out string of a number (was a coding challenge once)
View NumberSpell.class.php
class NumberSpell
public $number;
public $spelled;
private $rules = array(
0 => array('one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine'),
1 => array(null, 'twen', 'thir', 'for', 'fif', null, null, null, null)
d4rkne55 / DateIntervalEnhanced.class.php
Last active Jul 16, 2020
A DateInterval extension class
View DateIntervalEnhanced.class.php
* This class brings support for milliseconds, explicit recalculation of carry-over points
* and human-friendly formatting
class DateIntervalEnhanced extends DateInterval
public $ms = 0;
private $unitData = array(
d4rkne55 / StringTransform.class.php
Last active Oct 5, 2018
Class for some transformations on Strings
View StringTransform.class.php
class StringTransform
* This Method Converts a String to Title Case
* Not context-aware and just for english.
* @param string $str
* @param bool $apStyle use AP-Style title case if true
d4rkne55 / Media.class.php
Last active Jul 15, 2020
Class with some calculations and informations for media files
View Media.class.php
class Media
public $calcBase = 1024;
public $fileSize = 0;
public $sizePrefixes = array(
1000 => array(
d4rkne55 / parseColorString.php
Created Mar 9, 2017
This function is for parsing legacy color values. It is based on the WHATWG specs.
View parseColorString.php
function parseColorString($str, $format = 'hex') {
$str = strtolower(trim($str));
// prevent errors for an empty string and ignore 'transparent'
if ($str == '' || $str == 'transparent') {
return false;
// replace nonvalid hex characters with 0