Skip to content

Instantly share code, notes, and snippets.

View szepeviktor's full-sized avatar
🍓
Guess I'm the lone ranger keeping it all running.

Viktor Szépe szepeviktor

🍓
Guess I'm the lone ranger keeping it all running.
View GitHub Profile
@szepeviktor
szepeviktor / Environments.md
Last active June 29, 2025 11:10
Futtató környezetek szerepe egy szoftver életében

Környezetek

  • local - Fícsör kifejlesztése a saját gépen, amíg nem látszik a hiba
  • CI - Véleményt mondanak: minőségbiztosító eszközök, tesztek ✔ ❌, kollégák
  • staging - Bemutatjuk a hozzá nem értő ügyfélnek, illetve kipróbáljuk egy prod-hoz közeli körenyezetben
  • production - Oda adjuk a felhasználóknak
@szepeviktor
szepeviktor / wp-cli-array.sh
Created June 13, 2025 16:36
WP-CLI edit array option
wp option get auto_update_plugins --format=json \
| jq -c 'to_entries | map(select(.value != "wordpress-seo/wp-seo.php")) | from_entries' \
| wp option update auto_update_plugins --format=json
@szepeviktor
szepeviktor / HelloPack.sh
Created May 20, 2025 06:29
HelloPack plugin list and plugin update
# List plugin IDs
wp eval 'var_export(array_column(hellopack_client()->api()->plugins(),"name","id"));'
# Update the plugin
wp plugin install "$(wp eval 'echo hellopack_client()->api()->download(260729283,[]);')" --force
@szepeviktor
szepeviktor / glyph-width.php
Last active May 12, 2025 10:34
Estimate glyph widths for sans serif 16px font
<?php
function get_text_width(string $text): int
{
$glyph_widths = [
'A' => 10.67,
'B' => 10.67,
'C' => 11.55,
'D' => 11.55,
'E' => 10.67,
@szepeviktor
szepeviktor / zip-uploads.php
Last active May 8, 2025 06:04
Archive WordPress uploads in a ZIP file on the server
<?php
function addDirToZip(string $dir, ZipArchive $zipFile, string $basePath = '')
{
$files = scandir($dir);
// Remove '.' and '..'
unset($files[0], $files[1]);
foreach ($files as $file) {
$filePath = $dir . $file;
@szepeviktor
szepeviktor / comment-tor-spam.php
Last active March 29, 2025 18:37
Mark WordPress comments from Tor exit nodes as spam
<?php
/*
* Plugin Name: Mark comments from Tor exit nodes as spam
* Plugin URI: https://github.com/szepeviktor/wordpress-website-lifecycle
*/
/** @return string|null */
function getTorExitNodes()
{
@szepeviktor
szepeviktor / composer.json
Created March 28, 2025 15:16
WHMCS Composer repository
{
"repositories": [
{
"type": "composer",
"url": "https://releases.whmcs.com/v2"
}
],
"require": {
"whmcs/whmcs": "^8.9"
}
@szepeviktor
szepeviktor / qvik.txt
Created March 27, 2025 08:28
qvik QR kód leírása - GIRO
EAM KIEGÉSZÍTŐ SZOLGÁLTATÁSOK ÚTMUTATÓ
BKR ÜZLETSZABÁLYZAT 20. SZÁMÚ MELLÉKLETE
https://www.giro.hu/storage/DDOYCCedHv8YFOdILSOSNiuL6Mfmu6sv56y2HvBU/BKR%20%C3%9CSZ_20_mell%C3%A9klet_2024_09_01.pdf
@szepeviktor
szepeviktor / Hosting.md
Last active May 16, 2025 23:51
Hosting providers
@szepeviktor
szepeviktor / cpt-templates.php
Last active March 12, 2025 17:19
Programatically add custom post type template files to WordPress
<?php
/*
* Plugin Name: Add cpt templates
*/
add_filter(
'template_include',
function ($template) {
if (is_singular('cpt')) {