Skip to content

Instantly share code, notes, and snippets.

@soyuka
soyuka / remove_comments_prompt.sh
Created April 25, 2025 14:40
Remove comments of a PHP script from quagga
#!/bin/bash
# attention script completement généré par Gemini, testé et marche pour mon usage mais ne vous fiez pas non plus aveuglement a ce code
# quagga --output prompt.txt --include '*.php' --exclude Tests/ . --max-total-size=600000
# Script pour supprimer tous les commentaires (blocs et lignes),
# ainsi que les lignes vides des fichiers 'prompt.txt.NNN'
# et concaténer le résultat dans un seul fichier.
# Nom du fichier de sortie
@soyuka
soyuka / ReflectionClassRecursiveIterator.php
Created March 18, 2025 15:29
ReflectionClassRecursiveIterator with PSR-4 namespace
<?php
/*
* This file is part of the API Platform project.
*
* (c) Kévin Dunglas <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
@soyuka
soyuka / filter.php
Created March 18, 2025 10:26
Text search filter for JSON:API API Platform
<?php
use ApiPlatform\Metadata\OpenApiParameterFilterInterface;
use ApiPlatform\Metadata\Parameter;
use ApiPlatform\OpenApi\Model\Parameter as OpenApiParameter;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
final class PartialSearchFilter implements FilterInterface, OpenApiParameterFilterInterface
{
@soyuka
soyuka / dummy.collection.json
Created February 10, 2025 14:57
Hydra collection schema API Platform
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"definitions": {
"Dummy": {
"type": "object",
"description": "Dummy.",
"properties": {
"id": {
"readOnly": true,
@soyuka
soyuka / api-platform.yaml
Last active February 9, 2025 20:52
API Platform OpenAPI generated specification
openapi: 3.1.0
info:
title: 'My Dummy API'
description: |-
This is a test API.
Made with love
version: 0.0.0
servers:
-
url: /
<?php
/*
* This file is part of the API Platform project.
*
* (c) Kévin Dunglas <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
@soyuka
soyuka / update-hydra-context.php
Last active November 6, 2024 10:38
Update API Platform Hydra context from the online http://www.w3.org/ns/hydra/context.jsonld resource.
<?php
/*
* This file is part of the API Platform project.
*
* (c) Kévin Dunglas <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
@soyuka
soyuka / gist:f52aa1a14f86bdf5c55767f5c686a7ba
Created August 13, 2024 16:08
Use facebook upload api with symfony http client (warning this endpoint is not yet supported by facebook's own endpoints)
$uploadSession = $this->metaClient->request('POST', sprintf('%s/uploads', $this->metaAppId), [
'query' => [
'file_name' => $mediaObject->getFilePath(),
'file_length' => $mediaObject->getContentSize(),
'file_type' => $mediaObject->getMimeType(),
'access_token' => $credential->getAccessToken(),
'appsecret_proof' => $this->secretProof($credential->getAccessToken()),
],
])->toArray();
@soyuka
soyuka / components.php
Created January 17, 2024 21:30
components dependencies php
<?php
namespace Components;
use Symfony\Component\Finder\Finder;
$loader = require './vendor/autoload.php';
$namespace = 'ApiPlatform';
$prefix = 'api-platform';
$lnamespace = strlen($namespace);
@soyuka
soyuka / nodistraction.lua
Created October 9, 2023 12:53
No distraction mode neovim
local NoDistraction = { enabled = 0 }
NoDistraction.enable = function()
NoDistraction.enabled = 1
vim.cmd([[
set noshowmode
set noruler
set laststatus=0
set noshowcmd
set nonumber