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
const Alert = ({ error }) => { | |
if (!error) { | |
return null | |
} | |
return <div className='alert alert-error'>{error}</div> | |
} | |
export default Alert |
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 App\Entity; | |
use ApiPlatform\Core\Annotation\ApiResource; | |
use ApiPlatform\Core\Annotation\ApiProperty; | |
use App\Dto\Input; | |
/** | |
* @ApiResource(messenger="input", input=Input::class) |
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 App\DataTransformer; | |
use ApiPlatform\Core\DataTransformer\DataTransformerInterface; | |
use App\Entity\InputTodo; | |
use App\Entity\Todo; | |
final class DataTransformer implements DataTransformerInterface { | |
public function transform($object, string $to, array $context = []) |
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
fn exists<P: AsRef<Path>>(path: P) -> Result<bool> { | |
if let Err(e) = fs::metadata(path) { | |
if e.kind() != io::ErrorKind::NotFound { | |
return Err(e.into()) | |
} | |
return Ok(false) | |
} | |
Ok(true) |
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
use std::fs; | |
use std::path::Path; | |
use std::io; | |
/// Remove dir, if non empty just skip | |
fn rmdir<P: AsRef<Path>>(path: P) -> Result<(), io::Error> { | |
if let Err(e) = fs::remove_dir(path) { | |
if e.kind() != io::ErrorKind::Other { | |
return Err(e); | |
} |
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 | |
/* | |
* This file is part of the API Platform project. | |
* | |
* (c) Kévin Dunglas <dunglas@gmail.com> | |
* | |
* For the full copyright and license information, please view the LICENSE | |
* file that was distributed with this source code. | |
*/ |
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
// Entrypoint | |
#[get("/")] | |
fn index(path: DirectoryPath) -> Result<Template, Failure> { | |
list(path) | |
} | |
// Directory listing | |
#[get("/<path..>", rank = 2)] | |
fn dir(path: DirectoryPath) -> Result<Template, Failure> { | |
if !path.is_dir() { |
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
const fs = require('fs') | |
/** | |
* Usage: | |
* npm install | |
* node index.js > mime_types.rs | |
* | |
* IANA takes precedence over other sources. | |
*/ |
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 | |
// src/Serializer/Embedding/Embedded.php | |
namespace App\Serializer\Embedding; | |
/** | |
* @Annotation | |
* @Target({"PROPERTY", "METHOD"}) | |
*/ | |
class Embedded |
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); | |
namespace ApiPlatform\Workflow\PathResolver; | |
use ApiPlatform\Core\PathResolver\OperationPathResolverInterface; | |
final class OperationPathResolver implements OperationPathResolverInterface | |
{ |