Skip to content

Instantly share code, notes, and snippets.

View Crell's full-sized avatar

Larry Garfield Crell

View GitHub Profile
@Crell
Crell / .lando.yml
Last active March 22, 2024 00:22
Running Lando in GitHub Actions
name: myproject
recipe: laravel
config:
php: '8.1'
via: nginx
database: mysql:5.7
webroot: public
xdebug: true
services:
appserver:
@Crell
Crell / psr-7-now.php
Last active January 10, 2023 15:43
Immutable options, PSR-7 example
<?php
// PSR-7 today
class Request implements RequestInterface
{
private UriInterface $uri;
private array $headers = [];
private string $method = 'GET';
private string $version = '1.1';
@Crell
Crell / benchmark.php
Last active December 30, 2020 20:32 — forked from olleharstedt/benchmark.js
Clone benchmark
<?php
const ITERS = 1000000;
class QueryBuilder {
public $select;
public $from;
public $where;
public function withSelect($sel) {
FetchError: request to http://solr.internal:8080/solr/maincore/update? failed, reason: connect ECONNREFUSED 169.254.143.220:8080
at ClientRequest.<anonymous> (/app/node_modules/node-fetch/lib/index.js:1455:11)
at ClientRequest.emit (events.js:314:20)
at Socket.socketErrorListener (_http_client.js:469:9)
at Socket.emit (events.js:314:20)
at emitErrorNT (internal/streams/destroy.js:100:8)
at emitErrorCloseNT (internal/streams/destroy.js:68:3)
at processTicksAndRejections (internal/process/task_queues.js:80:21) {
type: 'system',
errno: 'ECONNREFUSED',
enum Option {
case None = new class {};
case Some = new class($val) {
public function __construct(private $val) {}
public function value() { return $val; }
};
public function value{} { throw new TypeError; }
}
echo "Installing Additional Plugins"
cd plugins
file="../plugins.txt"
while read -r line; do
[ "$line" = "\#*" ] && continue
git clone --depth=1 $line
done < grep -v -- "^#" "$file"
cd ..
$ php -d ffi.enable=preload -d opcache.preload="dummy-preload.php" dummy-test.php
PHP Fatal error: Uncaught FFI\Exception: Failed loading scope 'DUMMY' in /home/crell/temp/php-ffi-test/dummy.php:11
Stack trace:
#0 /home/crell/temp/php-ffi-test/dummy.php(11): FFI::scope()
#1 /home/crell/temp/php-ffi-test/dummy-test.php(7): Dummy->__construct()
#2 {main}
thrown in /home/crell/temp/php-ffi-test/dummy.php on line 11
<?php
use Aerys\Host;
use Aerys\Router;
use Kelunik\Demo\Chat;
use function Aerys\root;
use function Aerys\websocket;
// route /ws to the websocket endpoint
// you can add more routes to this router
function the_real_all(ServerRequestInterface $req, callable $next) {
$action = $req->getAttribute('_action');
$args = $req->getAttribute('_arguments);
$result = $action(...$args);
if (! $result instanceof ResponseInterface) {
$responder = resolve_responder(get_class($result));
$result = $responder($result);
}

Keybase proof

I hereby claim:

  • I am Crell on github.
  • I am crell (https://keybase.io/crell) on keybase.
  • I have a public key whose fingerprint is F230 376C 8EAE 38F8 B02B 879A 4FC0 2402 604A 0773

To claim this, I am signing this object: