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 | |
namespace F3\Changelog; | |
use Composer\Semver\Semver; | |
use F3\Changelog\Exception\NoTagsFound; | |
use F3\Changelog\Exception\TagNotFound; | |
use F3\ReleaseNotesGenerator\GitGateway; | |
class ReleaseNotes | |
{ |
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 Node | |
{ | |
/** | |
* @var string | |
*/ | |
private $value; | |
/** | |
* @var Node |
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 Config | |
{ | |
/** | |
* @var string | |
*/ | |
private $root; | |
public function __construct(string $root) | |
{ | |
$this->root = $root; |
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 | |
function three_asc(array $a) { | |
if (count($a) < 3) { | |
return false; | |
} | |
$min = $max = $new_min = 0; | |
for ($i = 1; $i < count($a); $i++) { | |
if ($min < $max) { | |
if ($a[$max] < $a[$i]) { | |
return [$min, $max, $i]; |
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 | |
public function upload(Request $request): array | |
{ | |
$tmp_file = tmpfile(); | |
stream_copy_to_stream($request->getContent(true), $tmp_file); | |
fflush($tmp_file); | |
$tmp_file_name = stream_get_meta_data($tmp_file)['uri']; | |
$this->logger->debug("File uploaded to $tmp_file_name"); | |
$tmp_file_type = mime_content_type($tmp_file_name); | |
if (!in_array($tmp_file_type, $this->allowed_mime_types)) { |
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 | |
function implode_recursive(string $glue, array $pieces) { | |
return implode( | |
$glue, | |
array_map(function ($v) use ($glue) { | |
return is_array($v) ? implode_recursive($glue, $v) : $v; | |
}, $pieces) | |
); | |
} |
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
#!/usr/bin/env bash | |
# | |
# Usage: bin/deploy.sh [-s] [-i] [-t <tag>] | |
# | |
# Configuration | |
RELEASE_DIR=/www/release | |
CURRENT=/www/current | |
while getopts ":sit:" OPT; do |
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 | |
function spiral(array $m) | |
{ | |
$x_max = sizeof($m) - 1; | |
if ($x_max < 1) { | |
return; | |
} | |
$y_max = sizeof($m[0]) - 1; | |
if ($y_max < 1) { | |
return; |
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 | |
/** | |
* Returns sorted array of all versions reachable from $version | |
* @param string $version | |
* @return string[] | |
*/ | |
public function getReachableVersions($version) | |
{ | |
$migrations = $this->migration_manager->getMigrations(); | |
$versions = array_keys($migrations); |
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 Spiral | |
{ | |
const RIGHT = 'RIGHT'; | |
const DOWN = 'DOWN'; | |
const LEFT = 'LEFT'; | |
const UP = 'UP'; | |
private $xMin = 0; | |
private $xMax = 0; |
NewerOlder