Skip to content

Instantly share code, notes, and snippets.

View sstok's full-sized avatar

Sebastiaan Stok sstok

View GitHub Profile
@sstok
sstok / readme.md
Created July 24, 2021 17:10
Model Encryption (POC ONLY)

Model Encryption

Model encryption is used for highly sensitive (or high risk) information, including bank-account numbers, or personal contact information.

Note:

Any information that legally falls under the General Data Protection Regulation (GDPR) must be stored encrypted according to legal requirements.

@sstok
sstok / example_form.html.twig
Created May 2, 2021 13:57 — forked from bjo3rnf/example_form.html.twig
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 data-action="form-collection#removeItem">
remove
</button>
</div>
{% endmacro %}
{% import _self as formMacros %}
@sstok
sstok / Login.php
Created July 31, 2020 13:33 — forked from kunicmarko20/Login.php
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;
@sstok
sstok / deploy.php
Created May 15, 2020 08:45
A sensible DeployerPHP config for Sf4 + Webpack / Webpack Encore
<?php
// See this article : https://foobarflies.io/a-sensible-deployerphp-config-for-sf4
namespace Deployer;
require 'recipe/symfony4.php';
set('ssh_type', 'native');
set('ssh_multiplexing', true);
@sstok
sstok / readme.md
Last active October 30, 2023 19:55
Form view ordering

There was a discussion about the ordering for the Forms (view level). symfony/symfony#5827 which unfortunately ended without a consensus.

You can handle this in the template itself, but that only works if you control the template that is used. Which is not always the case, FormTypeExtensions adding additional forms and theming like the SyliusThemeBundle provides.

Which means that whenever you add additional forms or change the theme you need to update this at multiple places.

sftp user

So you want to configure an sftp only user?

Setup a group for sftp only users

groupadd sftponly

Make chroot jail directory

@sstok
sstok / TransformationFailureExtension.php
Created February 11, 2019 19:17
TransformationFailureExtension.php (testing only)
<?php
use Symfony\Component\Form\AbstractTypeExtension;
use Symfony\Component\Form\Extension\Core\Type\FormType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\FormError;
use Symfony\Component\Form\FormEvent;
use Symfony\Component\Form\FormEvents;
class TransformationFailureExtension extends AbstractTypeExtension
@sstok
sstok / qa.Dockerfile
Created January 30, 2019 10:59 — forked from dkarlovi/qa.Dockerfile
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 \
@sstok
sstok / JooqObjectReflexionMapper.java
Created June 12, 2017 09:18 — forked from lilobase/JooqObjectReflexionMapper.java
Basic repository for CQRS system
public abstract class JooqObjectReflexionMapper<R> extends JooqObjectMapper<R> {
public JooqObjectReflexionMapper(ObjectMapper jackson) {
super(jackson);
}
@Override
public R map(Record record) {
HashMap<String, Class<?>> types = mapFieldsToTypes();
R instance = newInstance();
@sstok
sstok / app.php
Created December 27, 2016 15:19 — forked from wouterj/app.php
<?php
namespace App;
require __DIR__.'/vendor/autoload.php';
use Symfony\Component\Console\Application;
use Symfony\Component\Console\ConsoleEvents;
use Symfony\Component\Console\Event\ConsoleCommandEvent;
use Symfony\Component\Console\Input\InputArgument;