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
<?php
function trimURL( $psInput )
{
if ( mb_strlen( $psInput ) < 39 )
{
return $psInput ;
}
$aURL = @ parse_url( $psInput );
@sstok
sstok / ShortArraySyntaxFixer.php
Last active August 29, 2015 14:03
ShortArraySyntaxFixer for PHP-CS-Fixer
use Symfony\CS\FixerInterface;
use Symfony\CS\Tokens;
class ShortArraySyntaxFixer implements FixerInterface
{
public function fix(\SplFileInfo $file, $content)
{
$tokens = Tokens::fromCode($content);
for ($index = 0, $c = $tokens->count(); $index < $c; $index++) {
@sstok
sstok / (SQL) Injected
Last active March 20, 2024 12:55
parody-programming-songs 💩
Patient Zero - Infected - Hammer Fall
=====================================
I code alone, my screen begins to peel
Forsaken in my misery to battle this "OR" deal
I can't resist the cravings,
no I have to ease the pain
My screaming brain is melting slowly,
turning me insane
@sstok
sstok / DiffObjectCollections.php
Last active October 30, 2023 20:07
Domain helper stuff
<?php
use Assert\Assertion;
trait DiffObjectCollections
{
/**
* @var object[]
*/
protected $items;
@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;
@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 / 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 / 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

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 / 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.