Skip to content

Instantly share code, notes, and snippets.

View staabm's full-sized avatar
👋

Markus Staab staabm

👋
View GitHub Profile
@staabm
staabm / Linter.php
Last active December 10, 2023 08:40
fast-lint
<?php
declare(strict_types=1);
/*
* This file is part of the overtrue/phplint package
*
* (c) overtrue
*
* This source file is subject to the MIT license that is bundled
@staabm
staabm / test.php
Last active August 16, 2023 08:53
hoa regex capturing groups
<?php
use PHPStan\ShouldNotHappenException;
use PHPStan\Type\Constant\ConstantArrayTypeBuilder;
require __DIR__ . '/vendor/autoload.php';
// 1. Read the grammar.
$grammar = new Hoa\File\Read('hoa://Library/Regex/Grammar.pp');
@staabm
staabm / test.php
Created September 2, 2022 15:17
slow phpstan analysis Bug #7901
<?php
namespace a\spaceX;
class MailAddressList
{
const MAIL_LIST = [
'a',
'b',
'c',
'd',
<?php
$queryString = '
SELECT
land.*,
COALESCE(NULLIF(landsprache.ort, ""), land.ort) AS ort
FROM land
INNER JOIN landsprache ON (land.landid=landsprache.landid and landsprache.spracheid = ?)
WHERE (webinaktiv = 0) ORDER BY COALESCE(NULLIF(landsprache.ort, ""), land.ort) ASC
@staabm
staabm / user-export.diff
Created June 1, 2020 07:00
redaxo example console command
$ git diff --staged
diff --git a/redaxo/src/addons/project/lib/user_export.php b/redaxo/src/addons/project/lib/user_export.php
new file mode 100644
index 000000000..26a85625e
--- /dev/null
+++ b/redaxo/src/addons/project/lib/user_export.php
@@ -0,0 +1,25 @@
+<?php
+
+use Symfony\Component\Console\Input\InputInterface;
🌞 Morning 62 commits ███████▋░░░░░░░░░░░░░ 36.5%
🌆 Daytime 32 commits ███▉░░░░░░░░░░░░░░░░░ 18.8%
🌃 Evening 70 commits ████████▋░░░░░░░░░░░░ 41.2%
🌙 Night 6 commits ▋░░░░░░░░░░░░░░░░░░░░ 3.5%
@staabm
staabm / navigation_iterator.php
Last active July 30, 2020 14:07
redaxo navigation iterator
<?php
/**
* Klasse zum Erstellen von Navigationen, v0.1.
*
* benötigt PHP7!
*
* @package redaxo\structure
*/
@staabm
staabm / cd_catalog.xml
Last active September 7, 2016 08:03
test asset for php bug #73037
<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Body>
<CATALOG>
<CD>
<TITLE>Empire Burlesque</TITLE>
<ARTIST>Bob Dylan</ARTIST>
<COUNTRY>USA</COUNTRY>
<COMPANY>Columbia</COMPANY>
<PRICE>10.90</PRICE>
<YEAR>1985</YEAR>
</CD>
@staabm
staabm / FileSessionHandler.php
Last active February 12, 2023 20:20
Drop in replacement for the native php file session handler with lock-timeout support. Work arround PHP Bug #72345.
<?php
class FileSessionHandler implements SessionHandlerInterface
{
/**
* time in milliseconds how fast to poll the filesystem for a file-lock
* in case it cannot be acquired / is (b)locked by other resources.
*
* @var int
* @internal
<?php
<<<CONFIG
packages:
- "codeguy/arachnid: 1.*"
CONFIG;
set_time_limit(0);
$crawler = new \Arachnid\Crawler('https://www.example.com/', 5);
$crawler->traverse();