Skip to content

Instantly share code, notes, and snippets.

View ChristianOellers's full-sized avatar
🇨🇾

Christian Oellers ChristianOellers

🇨🇾
View GitHub Profile
@ChristianOellers
ChristianOellers / Text overflow - Line length cap.css
Last active June 10, 2024 07:42
CSS line length cap (Specific number + Equal heights)
/**
* Example: Cap text at a specific line length.
* Especially useful for e.g. card/ tile layouts with different content but equal heights.
*/
.text-overflow {
--lines: 3;
height: calc(var(--lines) * 1.25rem);
font-size: 1rem;
line-height: 1.25rem;
@ChristianOellers
ChristianOellers / Shopware 6 - Admin - 1 - Show info.css
Last active May 8, 2024 11:40
Shopware 6 - Admin - Styles.css
/**
* CMS editor / Shopping experiences: Hide rarely used section by default.
*/
.sw-cms-slot {
display: block;
min-height: 100px !important;
}
.sw-cms-sidebar__block-settings .sw-collapse:first-child .sw-collapse__content {
@ChristianOellers
ChristianOellers / php
Last active August 18, 2023 10:52
VS Code - PHP in Docker - Editor/IDE language support + linting
#!/bin/bash
docker exec -i --user=111:222 $(docker ps -q) /usr/bin/php "$@"
# Get PHP executable from container and send any argument to it.
#
# Assumptions
# - Calls the current container (docker ps -q).
# - Assumes PHP path exists in container as shown.
#
@ChristianOellers
ChristianOellers / ILogger.ts
Created July 26, 2023 10:38
Minimal console logger wrapper. TypeScript, Node, Jest, Angular. Architectural demo with interface, config, TDD. IoC optional.
export interface ILogger {
log(...args: any[]): void;
info(): void;
error(): void;
enable(): void;
disable(): void;
}
@ChristianOellers
ChristianOellers / RegEx-Snippets - Log analysis + Filtering.sh
Last active July 26, 2023 10:04
RegEx snippets for various tasks - Data analysis, filtering, validation, ... (PCRE, Bash).
# Exemplary snippets I've been using in my own projects. Use for inspiration and take what you need.
# 'sh' file format is for syntax highlighting only: The RegEx parts should work in many scenarios.
#
# Run all snippets to normalize varying strings by replacing or removing characters (as you need).
# Once all strings are aligned, duplicates can be filtered and lines sorted.
# This leaves the log with a few distinct, unique errors that are to be considered for development.
# RegEx design aims to leave the log syntax intact, e.g., delimiters (,"').
# This might be relevant for proper syntax highlighting or use with advanced analyzers.
# ---
@ChristianOellers
ChristianOellers / 1_Request-JSON-Data.php
Created July 3, 2023 12:37
Request + Routing - Minimalist zero-dependency PHP solution for JSON handling. Useful for development, not suited for production.
<?php
declare(strict_types=1);
namespace App;
use Exception;
use function addslashes;
use function file_get_contents;
@ChristianOellers
ChristianOellers / 0_Search-Queries.sql
Last active July 3, 2023 12:32
MySQL snippets - Specific search queries and example code.
-- Find in date range
SELECT *
FROM example
WHERE (updated >= '1970-01-01' AND updated <= DATE_ADD('1970-01-01', INTERVAL 1 DAY))
-- AND ...
-- Find by date format
SELECT * FROM example
-- WHERE ...
AND YEAR(updated_at) >= '1970'
@ChristianOellers
ChristianOellers / font-scaling.scss
Last active July 3, 2023 12:23
SCSS + Bootstrap snippets. Utilities and custom font scaling mechanism. Variables in separate file.
// Custom font scaling mechanism.
//
// This allows keeping a standardized base font size (e.g. 16px ~ 1rem),
// but applying custom scales for anything that is not regular text flow.
// Font scale factors (here large Desktop set as base scale).
$font-breakpoints: (
xs: 0.65,
sm: 0.7,
md: 0.75,
@ChristianOellers
ChristianOellers / .bash_aliases
Last active July 3, 2023 12:01
Symfony + Vagrant settings - VM configuration, aliases and snippets for speedy workflows.
#!/bin/bash
# Utility aliases to call from within running Vagrant box. Speed up fixing common, recurring issues during development.
# @todo - Adjust paths and commands as needed.
# TOC
# - Symfony
# - Logs
# - SYSTEM
@ChristianOellers
ChristianOellers / phpcs.xml
Created June 11, 2023 16:36
Symfony - PHPCS config (via Squizlabs), PSR-12 standard.
<?xml version="1.0" encoding="UTF-8"?>
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="vendor/squizlabs/php_codesniffer/phpcs.xsd">
<arg name="basepath" value="." />
<arg name="cache" value=".phpcs-cache" />
<arg name="extensions" value="php" />
<arg name="colors" />
<arg name="report" value="summary" />