Skip to content

Instantly share code, notes, and snippets.

View ollieread's full-sized avatar
👾
Build it all!

Ollie Read ollieread

👾
Build it all!
View GitHub Profile
@ollieread
ollieread / readme.md
Last active May 4, 2024 20:56
Idea for generic dependency-injection attributes for PHP

You could provide a number of generic and agnostic attributes for use with dependency-injection solutions without enforcing any sort of contract or implementing structure. This would be achieved by only targetting things that we know will be used. These attributes could be used with auto-wiring or a compilation state that collects all the data for production deployment or something.

These attributes:

  • Wouldn't enforce a particular implementation
  • Wouldn't restrict the usage of the class
  • Wouldn't even require DI.

Binding

<?php
/** @noinspection UnknownInspectionInspection */
declare(strict_types=1);
namespace Smpl\Logic;
use Smpl\Logic\Contracts\Consumer;
use Smpl\Logic\Contracts\Supplier;
use Smpl\Logic\Exceptions\OptionalException;
use Throwable;
@ollieread
ollieread / _undocumented-php.md
Last active January 22, 2023 16:28
Undocumented content on PHP

List of underdocumented functions/methods in PHP

pecl

svn

Classes

None

Methods

  • /reference/svn/functions/svn-fs-txn-root.xml
  • /reference/svn/functions/svn-repos-fs-commit-txn.xml
  • /reference/svn/functions/svn-fs-file-contents.xml
  • /reference/svn/functions/svn-fs-make-file.xml
@ollieread
ollieread / undocumented.md
Created January 16, 2023 16:31
Undocumented content for PHP
  • /reference/svn/functions/svn-fs-txn-root.xml
  • /reference/svn/functions/svn-repos-fs-commit-txn.xml
  • /reference/svn/functions/svn-fs-file-contents.xml
  • /reference/svn/functions/svn-fs-make-file.xml
  • /reference/svn/functions/svn-repos-recover.xml
  • /reference/svn/functions/svn-fs-youngest-rev.xml
  • /reference/svn/functions/svn-fs-props-changed.xml
  • /reference/svn/functions/svn-repos-fs.xml
  • /reference/svn/functions/svn-fs-make-dir.xml
  • /reference/svn/functions/svn-repos-fs-begin-txn-for-commit.xml
@ollieread
ollieread / PermissionParser.php
Created July 22, 2018 12:05
Parser for discord permission int returned by the API, and an implementation of their Snowflake IDs.
<?php
namespace Ollieread\Discord\Support;
/**
* Class PermissionCalculator
*
* @package Ollieread\Discord\Support
*/
class PermissionParser
@ollieread
ollieread / builder.php
Last active February 15, 2022 15:48
Laravel query builder recursive CTE support
<?php
$recursive = $this->query()
->recursive('parents', function (Builder $query) {
$query
->select([
'*',
new Alias('slug', 'fullslug'),
new Alias(0, 'depth'),
new Alias('id', 'tree_id'),
new Alias('name', 'path'),
{
"interval": 5,
"periodicity": 1,
"timeUnit": "minute",
"candleWidth": 2.49136786188579,
"volumeUnderlay": true,
"adj": true,
"crosshair": true,
"chartType": "line",
"extended": false,

Keybase proof

I hereby claim:

  • I am ollieread on github.
  • I am ollieread (https://keybase.io/ollieread) on keybase.
  • I have a public key whose fingerprint is 875A F004 3391 73AD 68A9 48A7 EFA1 4D8A B966 8432

To claim this, I am signing this object:

<?php
namespace Sprocketbox\Quartermaster\Http\Actions;
use Illuminate\Contracts\Pagination\LengthAwarePaginator;
use Illuminate\Contracts\Pagination\Paginator;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Collection;
use Sprocketbox\Quartermaster\Contracts\Resource;
@ollieread
ollieread / index.html
Last active April 25, 2018 11:50
Form isn't working
<!DOCTYPE html>
<html lang="en" class="wf-lato-i7-active wf-lato-n9-active wf-lato-n4-active wf-lato-i4-active wf-lato-n7-active wf-lato-i9-active wf-active gr__local_venuesearchlondon_com"><head>
<!-- Google Tag Manager -->
<script type="text/javascript" async="" src="https://widget.intercom.io/widget/lph7i9kd"></script><script src="//bat.bing.com/bat.js" async=""></script><script src="https://connect.facebook.net/signals/config/1148453628554257?v=2.8.14&amp;r=stable" async=""></script><script async="" src="https://connect.facebook.net/en_US/fbevents.js"></script><script type="text/javascript" async="" src="https://www.google-analytics.com/analytics.js"></script><script async="" type="text/javascript" src="http://www.googletagservices.com/tag/js/gpt.js"></script><script async="" src="https://www.googletagmanager.com/gtm.js?id=GTM-TVMQMR"></script><script>(function (w, d, s, l, i) {
w[l] = w[l] || [];
w[l].push({
'gtm.start':
new Date().getTime(), event: 'gtm.js