Skip to content

Instantly share code, notes, and snippets.

View vertexvaar's full-sized avatar

Oliver Eglseder vertexvaar

View GitHub Profile
@vertexvaar
vertexvaar / Test.html
Last active January 9, 2024 12:45
Backtracing ViewHelper
<html data-namespace-typo3-fluid="true"
xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers"
xmlns:n="http://typo3.org/ns/CoStack/NextConf/ViewHelpers"
>
<n:touched>
<h1>Here it goes</h1>
<n:touch/>
<n:touched>
<h2>Not rendered</h2>
@vertexvaar
vertexvaar / FrontendTest.php
Last active November 25, 2023 18:20
vxvr.de parallel browser tests in Chrome and Firefox with co-stack/stack-test
<?php
declare(strict_types=1);
namespace App\Tests\Acceptance;
use CoStack\StackTest\BrowserTestCase;
use CoStack\StackTest\Factory\SessionFactory;
use CoStack\StackTest\Session;
use DateTimeImmutable;
@vertexvaar
vertexvaar / k8s.sh
Created September 1, 2022 09:40
kubectl helper
# Delete all failed pods
kubectl delete pods -A --field-selector=status.phase=Failed
@vertexvaar
vertexvaar / check-devices-online.sh
Created May 6, 2022 06:54
Check if machine is connected to the internet
#!/bin/bash
# Taken from https://stackoverflow.com/a/44280885/2025722
# Added more devices (mainly from docker) to excluded list
find /sys/class/net/ -maxdepth 1 -mindepth 1 ! -name "*lo*" ! -name "veth*" ! -name "br-*" ! -name "docker*" -exec sh -c 'cat "$0"/carrier 2>&1' {} \; | grep -q '1'
@vertexvaar
vertexvaar / debounce.js
Created February 3, 2022 17:59
Debounce JS
const centreElement = function () {
console.log('Debounced');
}
const echoStuff = function () {
console.log('Stuff');
}
const createDebounce = function (fnc, delayMs) {
var timeout = null;
@vertexvaar
vertexvaar / fpsCounter.js
Created February 3, 2022 17:45
Count Browser Window Framerate with JavaScript
let previousTimeStamp = null, frames = 0;
function counter(timestamp) {
if (previousTimeStamp == null) {
previousTimeStamp = parseInt(timestamp / 1000);
}
frames = frames + 1;
const sec = parseInt(timestamp / 1000);
if (sec !== previousTimeStamp) {
previousTimeStamp = sec;
@vertexvaar
vertexvaar / _info.md
Last active January 20, 2022 09:55
Dual Web Setup

Project Structure

app/local <- contains a full TYPO3 project (and a composer.json)
app/foreign <- contains a full TYPO3 project (and a composer.json)
packages/ <- contains multiple repositories
app/tests <- codeception acceptance tests which test the interaction between multiple repositories.

repos from packages are installed via composer in both "local" and "foreign" TYPO3 instances.
Both composer.jsons has a repositories section with type path and url /packages/*

@vertexvaar
vertexvaar / aa_andreas.php
Last active December 9, 2021 10:24
Challenge: Find arrays by array
<?php
return [
'array_array_array_array' => static fn ($array, $search) => array_values(array_filter($array, static fn($item) => empty(array_diff_assoc($search, array_intersect_assoc($item, $search))))),
'array_array_array_array_keys' => static fn ($array, $search) => array_values(array_filter($array, static fn($item) => empty(array_diff_key($search, array_intersect_assoc($item, $search))))),
'array_array_array' => static fn ($array, $search) => array_values(array_filter($array, static fn($item) => array_intersect_assoc($item, $search) === $search)),
'array_array_array_long' => static function ($array, $search) {
$results = [];
$c = count($array);
@vertexvaar
vertexvaar / fair_random.php
Last active October 20, 2021 12:03
Making random fair again - for sorin
<?php
$original = $elements = [
'A' => 100,
'B' => 80,
'C' => 60,
'D' => 5,
];
function chooseElementFromWeightedList(array $list)