Skip to content

Instantly share code, notes, and snippets.

View sstok's full-sized avatar
🤒
Out sick

Sebastiaan Stok sstok

🤒
Out sick
View GitHub Profile
@kriswallsmith
kriswallsmith / Chain.php
Last active February 13, 2024 15:07
Symfony Messenger message chaining
<?php
declare(strict_types=1);
namespace App\Messenger\Chain;
use App\Messenger\Chain\Stamp\ChainStamp;
use Symfony\Component\Messenger\Envelope;
use Symfony\Component\Messenger\Stamp\StampInterface;
@quentint
quentint / wsl2-lando-phpstorm.md
Last active May 1, 2024 17:38
WSL2 / Lando / PhpStorm

This guide aims to be the reference for setting up Lando and PhpStorm tools on a WSL2 environment.

This assumes your project:

  • lives in a WSL2 instance (something like \\wsl$\Ubuntu\home\[user]\dev\my-demo-project)
  • Is "Lando-initialized" (lando init) and runs (lando start)
  • uses Composer, and dependencies are installed (lando composer install)

Docker

This guides relies on Docker for Windows, using the WSL2 based engine, and setup with WSL integration (Resources &gt; WSL Integration). Unfortunately I didn't find a solution to do without it and only rely on WSL's Docker.

@bjo3rnf
bjo3rnf / example_form.html.twig
Last active November 14, 2023 08:52
Stimulus.js controller for Symfony collection form type with configurable item limit
{% macro collection_item(form) %}
<div data-form-collection-target="field">
{{ form_widget(form) }}
<button type="button"
data-action="form-collection#removeItem">
remove
</button>
</div>
{% endmacro %}
@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

@kunicmarko20
kunicmarko20 / Login.php
Last active March 25, 2024 10:56
Symfony OAuth with Leage OAuth2 library
<?php
declare(strict_types=1);
namespace App;
use Symfony\Component\HttpFoundation\Response;
use Twig\Environment;
use League\OAuth2\Client\Provider\Google as GoogleProvider;
@kunicmarko20
kunicmarko20 / gcs
Last active August 25, 2021 10:01
Select branch to checkout from a list of recent ones.
#!/bin/bash
select branch in $(git branch --sort=-committerdate | head -n6 | grep -v "*")
do
git checkout $branch
exit
done
@dkarlovi
dkarlovi / README.md
Last active March 9, 2020 23:42
Split a large XML file into several smaller XML files

How to run

saxon -s:in.xml -xsl:split.xsl name=Products size=1200
<?php
declare(strict_types=1);
namespace Tests;
use Symfony\Bundle\FrameworkBundle\KernelBrowser;
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase as BaseWebTestCase;
use Symfony\Component\BrowserKit\Cookie;
use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken;
@calebporzio
calebporzio / pure_html_css_modal.css
Last active February 28, 2022 18:15
The CSS for the pure HTML/CSS modal I tweeted about.
details summary {
cursor: pointer;
outline: none !important;
display: inline-block;
padding: 8px 12px;
padding-top: 10px;
border-radius: 4px;
overflow: hidden;
background: #F09825;
color: white;
@dkarlovi
dkarlovi / qa.Dockerfile
Created January 30, 2019 10:56
QA Dockerfile
ARG BUILD_VERSION
FROM example.com/app:${BUILD_VERSION}
# copy QA tools from a known source
COPY --from=jakzal/phpqa:alpine /tools /tools/
COPY --from=jakzal/phpqa:alpine /usr/bin/composer /tools/
RUN apk add --update --no-cache \
curl \
openssl \