Skip to content

Instantly share code, notes, and snippets.

View vasilvestre's full-sized avatar
:shipit:
HTMX CEO

Valentin Silvestre vasilvestre

:shipit:
HTMX CEO
View GitHub Profile
@vasilvestre
vasilvestre / FilePathNormalizer.php
Created August 22, 2022 08:22
API Platform + Sylius + LiipImagine path resolver
<?php
namespace App\Serializer;
use Liip\ImagineBundle\Imagine\Cache\CacheManager;
use Sylius\Component\Core\Model\ImageInterface;
use Symfony\Component\Serializer\Normalizer\ContextAwareNormalizerInterface;
use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface;
use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait;
{# @var ea \EasyCorp\Bundle\EasyAdminBundle\Context\AdminContext #}
{# @var field \EasyCorp\Bundle\EasyAdminBundle\Dto\FieldDto #}
{# @var entity \EasyCorp\Bundle\EasyAdminBundle\Dto\EntityDto #}
<time datetime="{{ field.value|date('c') }}" title="{{ field.value|date('r') }}">{{ field.formattedValue }}</time>
@vasilvestre
vasilvestre / php-amqp-example.php
Created August 24, 2021 11:08
PHP AMQP exemple
<?php
$url = parse_url(getenv('CLOUDAMQP_URL'));
$vhost = substr($url['path'], 1);
$credentials = [
'host' => $url['host'],
'vhost' => $vhost,
'login' => $url['user'],
'password' => $url['pass'],
@vasilvestre
vasilvestre / README.md
Last active June 1, 2021 20:22
Chrome extension ws connect + read current tab + node js ws server

npm install ws

{
"$schema": "https://json.schemastore.org/resume",
"meta": {
"theme": "kendall"
},
"basics": {
"name": "Valentin Silvestre",
"label": "Developer",
"image": "https://avatars.githubusercontent.com/u/17164385?v=4",
"email": "vsilvestre.pro@gmail.com",
@vasilvestre
vasilvestre / README.md
Last active June 18, 2020 15:05
Programmatically login as User in Symfony 4.3+ to 5 App with Behat + Mink 1.8 + FriendsOfBehat/SymfonyExtension

The TestBrowserToken is a copy modified for my needs and taken from here

It's first a Symfony feature implemented in 5.1 here, it's just the mink adaptation with new super Symfony extension.

#!/usr/bin/env php
<?php
require __DIR__ . '/vendor/autoload.php';
use Elasticsearch\ClientBuilder;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\SingleCommandApplication;
use Symfony\Component\Serializer\Encoder\JsonDecode;
use Symfony\Component\Serializer\Normalizer\ArrayDenormalizer;
@vasilvestre
vasilvestre / moyenne par ue
Last active July 11, 2019 20:42
Script notes agora
var rows = document.querySelectorAll("#listTab_319776288 > tbody > tr");
var output = 'init';
var notes = 0;
var notesParUe = 0;
var nbNotesParUe = 0;
rows.forEach(function(row) {
var columns = row.querySelectorAll("td");
if (columns.length === 1) {
if (output !== '') {
//console.log(notesParUe);console.log(nbNotesParUe);
@vasilvestre
vasilvestre / Setup.md
Last active May 25, 2021 01:35
Borderlands 2 : Reborn mod setup (07/04/2019)

Disclaimer

It work for Windows 10 only and a new game install

prerequisite

  • Borderlands 2
  • Hex multitool 1.24 HERE
  • Java 1.8 HERE
  • Borderlands Community Mod Manager HERE
  • BL2Reborn HERE
@vasilvestre
vasilvestre / gist:1399ca951ac584a40ff995ca39cd1b72
Last active November 14, 2018 15:27
c++ hash speed of program
class Benchmark
{
private:
bool started = false;
bool benched = false;
float functionCalls = 0;
std::chrono::high_resolution_clock::time_point startHash;
std::chrono::high_resolution_clock::time_point startBenchmark;
public:
void