Skip to content

Instantly share code, notes, and snippets.

View mathiasschopmans's full-sized avatar
☁️

Mathias Schopmans mathiasschopmans

☁️
View GitHub Profile
@mathiasschopmans
mathiasschopmans / workflow.yml
Created July 30, 2021 08:14
GitHub Action to test, build, push & deploy PHP based application
name: CI
on:
push:
branches-ignore:
- 'dependabot/**'
tags:
- 'v*'
pull_request:
branches-ignore:
@mathiasschopmans
mathiasschopmans / pluckRecursive.ts
Created January 2, 2023 12:49
pluck recursive attribute with native methods
export function pluckRecursive(input: any, prop: string, collect = []) {
collect = collect || [];
if (!input) return collect;
if (Array.isArray(input)) {
input.forEach(function (value) {
pluckRecursive(value, prop, collect);
})
} else if (typeof input === 'object') {
@mathiasschopmans
mathiasschopmans / commit-msg
Last active October 7, 2024 09:15
Git commit hook using bash to validate the commit message against conventional commits
#!/bin/bash
# Get the commit message
commit_msg=$(cat $1)
# Define a regex pattern to match the conventional commit message format
pattern='^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test)(\([a-z]+\))?!?: .+$'
# Test if the commit message matches the pattern
if ! [[ $commit_msg =~ $pattern ]]; then
@mathiasschopmans
mathiasschopmans / debounce.ts
Created November 13, 2024 14:09
Async TypeScript helpers
/**
* Creates a debounced version of an asynchronous function that delays the execution
* of the function until after `wait` milliseconds have elapsed since the last time it was invoked.
*
* @template Args - The argument types of the function being debounced.
* @template R - The return type of the function being debounced.
*
* @param {(...args: Args) => Promise<R>} func - The asynchronous function to debounce.
* @param {number} [wait=150] - The number of milliseconds to delay; defaults to 150ms.
* @returns {(...args: Args) => Promise<R>} - A debounced version of the function that returns a promise.
@mathiasschopmans
mathiasschopmans / README.md
Last active January 8, 2025 14:09
Resolving Playwright Issues with Node.js 23.6.0 and Type Stripping

Resolving Playwright Issues with Node.js 23.6.0 and Type Stripping

This morning, my local Node.js version was automatically updated to 23.6.0 via Homebrew. While the update itself seemed harmless at first, it led to some mysterious errors when using Playwright with a TypeScript configuration:

(node:27126) ExperimentalWarning: Type Stripping is an experimental feature and might change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
SyntaxError: The requested module '@playwright/experimental-ct-react' does not provide an export named 'PlaywrightTestConfig'
SyntaxError: The requested module '@playwright/experimental-ct-react' does not provide an export named 'PlaywrightTestConfig'