Skip to content

Instantly share code, notes, and snippets.

View simonrjones's full-sized avatar

Simon R Jones simonrjones

View GitHub Profile
@simonrjones
simonrjones / .gitignore
Last active August 5, 2022 10:00
Global gitignore settings.
# Standard ignore rules
# OS generated files
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db
function excerpt(string $string, $length = 50): string
{
$string = explode("\n", wordwrap($string, $length));
return (string) $string[0];
}
@simonrjones
simonrjones / Get package version
Created April 16, 2021 19:05
Return package version dynamically from Composer 2
<?php
declare(strict_types=1);
namespace MyNamespace;
use Composer\InstalledVersions;
/**
* Simple class to return package version from Composer 2

Keybase proof

I hereby claim:

  • I am simonrjones on github.
  • I am simonrjones (https://keybase.io/simonrjones) on keybase.
  • I have a public key ASByeWwYfViAGNL4E1h9deMit0iU4VK6gVWdiCyoR9SaRAo

To claim this, I am signing this object:

@simonrjones
simonrjones / hash_examples.php
Created April 26, 2024 07:07
Output example hashed values from different hash algorithms
array_walk(hash_algos(), function($algo) {
echo $algo . ': ' . hash($algo, 'TEST123') . PHP_EOL;
});