Skip to content

ocallit/util

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

util

Utilities

WIP

css dialogs Documentation

See SCH Dialog System Documentation for complete usage guide.

Memorize

Store result of slow computation, considering parameter values, for a pure function

	#[Pure]
    function memorize_commonPattern($a, $b = 2, $c = null): array {
        $MemorizeKey = Memorize::generateKey(__METHOD__, func_get_args());
        if(Memorize::hasKey($MemorizeKey)) 
			return Memorize::getValue($MemorizeKey);

		// ... slow process to memotize

        $exampleReturnValue = [1,2,3,4];
        Memorize::setValue($MemorizeKey, $exampleReturnValue);
        return $exampleReturnValue;
    }

NaturalSorter

A case and accent insensitivity, natural compare, multi key array sort and collator

  • natural sort sorts numbers and number substrings gracefully
 	$sorter = new NaturalSorter();
 	$sorter->sort($data, ["age" => "desc", "name"=>"asc"]);
 	$sorter->compare('si", "Sí'); // instead of natcasesort, strcasecmp or <=>:

HtmlEr

Pwder

Session

FirebaseRealtimeDb

Uploader (v1)

Uploader (v2)

About

Utilities

Resources

License

Stars

Watchers

Forks

Packages

No packages published