Skip to content

Instantly share code, notes, and snippets.

View jswebschmiede's full-sized avatar
🏠
Working from home

Joerg Schoeneburg jswebschmiede

🏠
Working from home
View GitHub Profile
- Always answer in German
- Don’t apologize for errors: fix them.
- Comments MUST include purpose(s)
- If you can’t finish code, add #TODO: comments.
- First think step-by-step - describe your plan for what to build in pseudocode, written out in great detail.
- Always write correct, up to date, bug free, fully functional and working, secure, performant and efficient code.
- Favor clear and understandable code, addressing any performance trade-offs with reasoned explanations.
- Embed accessibility features, including ARIA roles and attributes, to make applications inclusive. Detail the purpose of each accessibility enhancement.
- Aim for clarity and efficiency in both code and explanations. Avoid unnecessary elaboration to keep solutions straightforward and understand
- Follow language-specific best practices and maintain consistent naming, structure, and formatting. Be adaptable to different organizational standards.
@jswebschmiede
jswebschmiede / Dockerfile
Last active May 18, 2024 09:24
PHP Environment with Docker
#Dockerfile needs to be in folder /services/php
FROM php:fpm
RUN groupadd -g 1000 develop && \
useradd -u 1000 -g 1000 -m develop
RUN apt-get update && \
apt-get install -y zip libzip-dev libmagickwand-dev zlib1g-dev libpng-dev libjpeg-dev --no-install-recommends && \
rm -rf /var/lib/apt/lists/*
$formLayout = preg_replace(['/style=\\"[^\\"]*\\"/', '/\b(?:cf-btn)(?!-)\b/'], '', $formLayout);
@jswebschmiede
jswebschmiede / docker-compose.yml
Last active July 15, 2024 11:28
Joomla Docker Compose
services:
joomla:
image: joomla:latest
restart: unless-stopped
links:
- db:mysql
depends_on:
- db
healthcheck:
test: ['CMD-SHELL', 'mysqladmin ping -h localhost -u root -psecret']
<?php
session_start();
// Zeitraum in Sekunden, in dem die Anzahl der Versuche begrenzt wird
$limitPeriod = 3600; // 1 Stunde
// Maximale Anzahl erlaubter Versuche pro IP-Adresse und Fingerprint innerhalb des Zeitraums
$maxAttempts = 3;
// Generiere einen eindeutigen Fingerprint basierend auf IP-Adresse, User-Agent und Cookies
<?php
session_start();
// Zeitraum in Sekunden, in dem die Anzahl der Versuche begrenzt wird
$limitPeriod = 3600; // 1 Stunde
// Maximale Anzahl erlaubter Versuche pro IP-Adresse innerhalb des Zeitraums
$maxAttempts = 3;
// Eindeutiger Schlüssel für die IP-Adresse in der Session
@jswebschmiede
jswebschmiede / image-src-regexpr.php
Created March 23, 2023 15:46 — forked from vyspiansky/image-src-regexpr.php
PHP: get image src attribute (regular expression)
<?php
// Source: http://goo.gl/qyLFbg
$html = '<img border="0" src="/images/image.jpg" alt="Image" width="100" height="100" />';
preg_match( '@src="([^"]+)"@' , $html, $match );
$src = array_pop($match);
// will return /images/image.jpg
@jswebschmiede
jswebschmiede / scrollTo.js
Created February 2, 2023 14:37 — forked from frob/scrollTo.js
a native scrollTo function in javascript that uses requestAnimationFrame and easing for animation
// easing functions http://goo.gl/5HLl8
Math.easeInOutQuad = function (t, b, c, d) {
t /= d/2;
if (t < 1) {
return c/2*t*t + b
}
t--;
return -c/2 * (t*(t-2) - 1) + b;
};
<?php
class JoomlaHelper{
/**
* Obtiene la versión de Joomla (3,4, ...)
*
* @return string Versión mayor de Joomla
*/
@jswebschmiede
jswebschmiede / javascript.json
Last active November 19, 2022 12:58
Javascript Snippets Json
{
"Arrow Function": {
"prefix": "arrow",
"body": ["const $1 = () => {", "$0", "}"],
"description": "Arrow Function"
},
"Fetch": {
"prefix": "fetch",
"body": [
"try {",