View classes.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class FooSettings | |
{ | |
public function __construct( | |
public readonly int $id, | |
public readonly string $name, | |
) { | |
} | |
} |
View Psr11ContainerAdapter.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
declare(strict_types=1); | |
use Psr\Container\ContainerInterface; | |
use Nette\DI\Container; | |
class Psr11ContainerAdapter implements ContainerInterface | |
{ | |
public function __construct( |
View nette-events.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Circle | |
{ | |
public array $onChange = []; | |
public float $radius = 0; | |
public function setRadius(float $radius): void | |
{ | |
foreach ($this->onChange as $handler) { |
View counter.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$path = getcwd(); | |
echo "Scanning $path\n"; | |
$it = new RecursiveDirectoryIterator($path); | |
$it = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::LEAVES_ONLY); | |
$it = new RegexIterator($it, '~\.latte$~'); | |
$countPair = 0; | |
$countUnpair = 0; | |
foreach ($it as $file) { |
View git2json.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# install pygit2: pip install pygit2 | |
import pygit2 | |
import json | |
repo = pygit2.Repository('path/to/repository') | |
last = repo[repo.head.target] | |
data = [] | |
for commit in repo.walk(last.id): |
View example.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
declare(strict_types=1); | |
if (@!include __DIR__ . '/../vendor/autoload.php') { | |
die('Nainstalujte balíčky pomocí `composer require nette/forms`'); | |
} | |
use Nette\Forms\Form; |
View example.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
declare(strict_types=1); | |
if (@!include __DIR__ . '/../vendor/autoload.php') { | |
die('Install packages using `composer require nette/forms`'); | |
} | |
use Nette\Forms\Form; |
View benchmark.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
declare(strict_types=1); | |
require __DIR__ . '/vendor/autoload.php'; | |
// create container | |
$configurator = new Nette\Configurator; | |
$configurator->setTempDirectory(__DIR__ . '/temp'); |
View composer-frontline.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
declare(strict_types=1); | |
// Updates all the version constraints of dependencies in the composer.json file to their latest version. | |
// | |
// usage: composer-frontline.php (updates all Nette packages) | |
// composer-frontline.php doctrine/* (updates all Doctrine packages) | |
// composer-frontline.php * (updates all packages) |
View patch-CVE-2020-15227.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
# In-place apply the CVE-2020-15227 nette/application patch | |
# This is a universal patcher for all affected versions. | |
# Run with `php patch-CVE-2020-15227.php` | |
# Inspiration: @spazef0rze | |
NewerOlder