Skip to content

Instantly share code, notes, and snippets.

@tomasnorre
tomasnorre / DataService.php
Last active Apr 22, 2021
DataServer to Fetch JSON from URL and store in cache.
View DataService.php
<?php
declare(strict_types=1);
namespace App\Services;
use GuzzleHttp\Client;
use GuzzleHttp\Exception\GuzzleException;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\Log;
@tomasnorre
tomasnorre / debug-output.txt
Created Apr 5, 2021
Problem fetching box from Artifactory
View debug-output.txt
vagrant up --debug
INFO global: Vagrant version: 2.2.15
INFO global: Ruby version: 2.6.6
INFO global: RubyGems version: 3.0.3
INFO global: VAGRANT_SERVER_ACCESS_TOKEN_BY_URL="true"
INFO global: VAGRANT_SERVER_URL="https://server.tld/artifactory/api/vagrant/devboxes"
INFO global: VAGRANT_INSTALLER_VERSION="2"
INFO global: VAGRANT_INSTALLER_ENV="1"
INFO global: VAGRANT_INSTALLER_EMBEDDED_DIR="/opt/vagrant/embedded"
INFO global: VAGRANT_EXECUTABLE="/opt/vagrant/embedded/gems/2.2.15/gems/vagrant-2.2.15/bin/vagrant"
@tomasnorre
tomasnorre / webpack.config.js
Created Jan 6, 2021 — forked from bjo3rnf/webpack.config.js
Tailwind CSS in a Symfony Project with Webpack Encore and Purge CSS
View webpack.config.js
const Encore = require('@symfony/webpack-encore');
const tailwindcss = require('tailwindcss');
const autoprefixer = require('autoprefixer');
const purgecss = require('@fullhuman/postcss-purgecss')({
content: [
'./templates/**/*.twig',
'./assets/js/**/*.vue',
'./assets/js/**/*.js',
View Classes_QueueExecutor.php
<?php
declare(strict_types=1);
namespace AOE\Crawler;
use AOE\Crawler\Controller\CrawlerController;
use AOE\Crawler\Converter\JsonCompatibilityConverter;
use AOE\Crawler\CrawlStrategy\CallbackExecutionStrategy;
@tomasnorre
tomasnorre / .Question.txt
Last active Jul 13, 2020
How to best write Unit tests for this ?
View .Question.txt
Hi,
How would you write unit-test for this function? addFlushedPagesToCrawlerQueue()
With a functional test I would check the queue size, if the expected number of pages was added to the queue,
but not sure how to deal with this in unit-tests.
Could you please give me some pointer.
I have added DataHandlerHookTests.php with an idea, but as I always expect null, I would not know which return route it has taken. Therefore... Bad Tests..
@tomasnorre
tomasnorre / wrap.ts
Created Jun 10, 2020
scroll-to attribute
View wrap.ts
lib.parseFunc_RTE {
tags.a {
# Add scroll-to directive to anchor links on the current page
# * href uses the linkhandler t3:// URL scheme, with page and anchor id separated by "#", e.g. t3://page?uid=283287#6613007
# * when splitting the href by "#", the second list item contains the target anchor id
# * the if.equals block extracts the target page uid from the link and compares it to the page id being processed
# * By using append.required = 1, the scroll-to directive will only be added if the stdWrap returns an anchor id
typolink.ATagParams.append = TEXT
typolink.ATagParams.append {
stdWrap {
@tomasnorre
tomasnorre / 01_Problem.md
Last active Jun 1, 2020
Symfony - controller.service_arguments
View 01_Problem.md

I'm like 6 hours old in working with symfony, and I really love the documentation, but this one bit I don't get what I'm doing wrong.

When calling my url: /game/complete?personId=1&exerciseId=2 i get the error:

Could not resolve argument $personId of "App\Controller\GameController::complete()", maybe you forgot to register the controller as a service or missed tagging it with the "controller.service_arguments"?

Problem Solved: I was missing the params in my routing annotation, see updated file.

View gist:0013707efce157c313f1fd860a1e7cfa
I got the same yesterday with Intellij and it took me quite long to fix it. This worked worked for me (You need to adapt the paths to Webstorm):
```
rm -rf ~/Library/Application\ Support/JetBrains/IntelliJIdea2020.1/plugins/*
rm -rf ~/Library/Application\ Support/JetBrains/IntelliJIdea2020.1/disabled_plugins.txt
```
I found it here: https://intellij-support.jetbrains.com/hc/en-us/community/posts/360007952039-Android-support-in-IDEA-2020-1-Ultimate-is-gone-
@tomasnorre
tomasnorre / crawler-devbox.yml
Created Apr 10, 2020
Site Configuration TYPO3 9LTS
View crawler-devbox.yml
base: 'https://crawler-typo3v9.ddev.site/'
baseVariants: { }
errorHandling: { }
languages:
-
title: Default
enabled: true
base: /
typo3Language: default
locale: en_US.UTF-8
View composer.json
{
"name": "tnm/typo3v10-test",
"type": "project",
"description": "",
"require": {
"typo3/minimal": "^10.2",
"typo3/cms-introduction": "~4.0",
"typo3/cms-tstemplate": "^10.2",
"typo3/cms-info": "^10.2",
"typo3/cms-belog": "^10.2",