Skip to content

Instantly share code, notes, and snippets.

View dingo-d's full-sized avatar

Denis Žoljom dingo-d

View GitHub Profile
@dingo-d
dingo-d / conf.phperrorlog
Last active March 26, 2024 21:40
Config examples for debug, and error logs with grc: https://github.com/garabik/grc
# Highlight time
regexp=^\[\d\d-[A-Z][a-z][a-z]-\d\d\d\d \d\d:\d\d:\d\d [A-Z]{3}\]
colour=dark
count=once
-
# Highlight file paths with lines at end
regexp=(/[A-z0-9-]+)+.php:[\d]+
colour=green
count=more
-
This file has been truncated, but you can view the full file.
<html><head><meta http-equiv="Content-Type" content="text/html;charset=utf-8"><meta name="author" content="JetBrains"><script type="text/javascript" src="script.js"></script><link rel="stylesheet" type="text/css" href="styles.css"/><title>PhpStorm inspection report</title></head><body><h3>PhpStorm inspection report:</h3><div style="width:100%;"><div style="float:left; width:50%;"><h4>Inspection tree:</h4><li><label for="174171066"><b>'InspectionViewTree' project</b>&nbsp;<span class="grayout">&nbsp;&nbsp;6&nbsp;errors&nbsp;53&nbsp;warnings&nbsp;127&nbsp;weak&nbsp;warnings&nbsp;477&nbsp;typos&nbsp;</span></label><input type="checkbox" checked onclick="navigate(174171066)" id="174171066" /><ol class="tree"><li><label for="349200440"><b>CSS</b>&nbsp;group&nbsp;<span class="grayout">&nbsp;&nbsp;1&nbsp;warning&nbsp;</span></label><input type="checkbox" onclick="navigate(349200440)" id="349200440" /><ol class="tree"><li><label for="1676378579"><b>Invalid&nbsp;elements</b>&nbsp;group&nbsp;<span class="grayout">&n
@dingo-d
dingo-d / renameTests.php
Created May 25, 2020 12:24
Append Test to test file name script
#!/usr/bin/env php
<?php
function getDirs( $currentDir ) {
return array_filter( $currentDir, function ( $dir ) {
return is_dir( $dir ) && $dir !== '..' && $dir !== '.';
} );
}
@dingo-d
dingo-d / rename.php
Last active May 25, 2020 12:22
Simple php script to rename folder names to PascalCase from split-name. Doesn't go recursively in subfolders.
#!/usr/bin/env php
<?php
function getDirs( $currentDir ) {
return array_filter( $currentDir, function ( $dir ) {
return is_dir( $dir ) && $dir !== '..' && $dir !== '.';
} );
}
@dingo-d
dingo-d / ajax.js
Created April 17, 2020 14:50
Download users from WordPress admin
export const ajaxFetch = (options, resolve, reject) => $.ajax(options)
.done(resolve)
.fail(reject);
@dingo-d
dingo-d / PHP Class
Last active August 5, 2020 07:56
PHPStorm PHP class file templates (class, trait and interfaces). To modify go to Settings > Editor > File and Code Templates
<?php
/**
* File holding ${NAME} class
*
#if (${NAMESPACE}) * @package ${NAMESPACE}
#end
* @since
*/
@dingo-d
dingo-d / extract-versions.sh
Created April 7, 2020 12:01
A simple shell command script to extract packages and their versions from Gutenberg WP editor. Once in the 'packages' directory you can run this script
for package in $(ls -1); do echo $package; jq -r .version $package/package.json; done
@dingo-d
dingo-d / phpcs-results.txt
Created February 16, 2020 17:07
The result of vendor/bin/phpcs --sniffs=WordPress.WP.i18n ../WordPress-Themes/themes/ --report-file=../phpcs-result.txt --error-severity=0 --extensions=php --report=code
FILE: mnt/d/WordPress-Themes/themes/lightning/comments.php
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
LINE 28: WARNING Mismatched placeholders is probably an error (WordPress.WP.I18n.MismatchedPlaceholders)
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
26: » » <h2·class="comments-title">
27: » <?php
>> 28: » printf(·_nx(·'One·thought·on·&ldquo;%2$s&rdquo;',·'%1$s·thoughts·on·&ldquo;%2$s&rdquo;',·get_comments_number(),·'comments·title',·'lightning'·),
@dingo-d
dingo-d / test-api-doc-response.php
Created January 3, 2020 09:54
A test for API response
<?php
/**
* Class Api_Docs_Page
*
* @package My_Plugin\Routes\Endpoints
*/
namespace My_Plugin\Tests\Routes\Endpoints;
use WP_REST_Request;
FILE: ...wp-graphql/src/Connection/Themes.php
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
1 | ERROR | Missing file doc comment
| | (Squiz.Commenting.FileComment.Missing)
----------------------------------------------------------------------
FILE: ...wp-graphql/src/Connection/Comments.php
----------------------------------------------------------------------