Skip to content

Instantly share code, notes, and snippets.

View GromNaN's full-sized avatar
🚲
☀️

Jérôme Tamarelle GromNaN

🚲
☀️
View GitHub Profile
@GromNaN
GromNaN / async-twig.php
Last active May 6, 2024 09:57
Asynchronous Twig PHP
<?php
/**
* Demo ReactPHP application using Twig in yielding mode with an async function.
*/
namespace App;
use Exception;
use Psr\Http\Message\ServerRequestInterface;
@GromNaN
GromNaN / RevoltHttpClient.php
Last active December 18, 2023 16:05
Fiber powered Symfony HttpClient with Revolt (and AMPHP)
<?php
namespace App;
use Revolt\EventLoop;
use Symfony\Contracts\HttpClient\HttpClientInterface;
class RevoltHttpClient
{
private int $requests = 0;
@GromNaN
GromNaN / RouterTest.php
Created December 15, 2021 20:43
Symfony Integration test for route configuration: controller does neither exist as service nor as class
<?php
namespace Tests\Integration;
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Controller\ControllerResolverInterface;
use Symfony\Component\HttpKernel\HttpKernelInterface;
use Symfony\Component\Routing\RouterInterface;
@mnapoli
mnapoli / README.md
Last active October 22, 2021 17:13
PrettyCI migration

This page will help you run continuous integration for PHP CodeSniffer and PHP-CS-Fixer using GitHub Actions.

To setup GitHub Actions in your repository, create a .github/workflows/ci.yml file in your repository and commit it.

The content of that file depends on the tool you want to run, please read the examples below.

Note: the examples below are provided to get you started easily, it is possible you may need to adjust them to fit your project.

php-cs-fixer

@bangpound
bangpound / vault-iam-auth.php
Last active March 18, 2021 21:33
AWS IAM authentication to Vault with AWS SDK v3 on PHP
<?php
// Use the AWS security token service's GetCallerIdentity command
// to produce a request that allows Vault to identify the instance
// that wants to authenticate.
//
// @see https://gist.github.com/joelthompson/378cbe449d541debf771f5a6a171c5ed
$sts = new \Aws\Sts\StsClient([
'region' => 'us-east-1',
@simonw
simonw / redis-docker-for-mac.md
Last active August 26, 2024 17:27
How to run a redis server using Docker-for-Mac

How to run a redis server using Docker-for-Mac

This will work with other flavours of Docker as well.

Run the following command:

docker run --name my-redis -p 6379:6379 --restart always --detach redis

This will download and run redis, set to auto-restart when your machine starts and bound to port 6379 on your machine.

FWIW: I (@rondy) am not the creator of the content shared here, which is an excerpt from Edmond Lau's book. I simply copied and pasted it from another location and saved it as a personal note, before it gained popularity on news.ycombinator.com. Unfortunately, I cannot recall the exact origin of the original source, nor was I able to find the author's name, so I am can't provide the appropriate credits.


Effective Engineer - Notes

What's an Effective Engineer?

import React from 'react';
class EmbedIframe extends React.Component {
resizeIframe = () => {
const height = Math.max(this.props.minHeight, this.iframe.contentWindow.document.body.offsetHeight);
this.iframe.height = `${height}px`;
}
componentDidMount = () => {
@marcw
marcw / deploy.sh
Created September 9, 2016 13:52
Symfony deployment bash script
#!/bin/bash
# some configurations values
host="foobar-web00" # the name of the host in my ssh config file
project_path="/var/www/foobar"
user="web"
key_filename="/path/to/.ssh/web-deploy-key"
dry_run="--dry-run"
assets_differ=""
@jehaby
jehaby / README.md
Last active October 8, 2024 17:23 — forked from chadrien/README.md
Debug PHP in Docker with PHPStorm and Xdebug

Debug your PHP in Docker with Intellij/PHPStorm and Xdebug

  1. For your local dev, create a Dockerfile that is based on your production image and simply install xdebug into it. Exemple:
FROM php:5

RUN yes | pecl install xdebug \
    && echo "zend_extension=$(find /usr/local/lib/php/extensions/ -name xdebug.so)" > /usr/local/etc/php/conf.d/xdebug.ini \