Skip to content

Instantly share code, notes, and snippets.

Denis Žoljom dingo-d

Block or report user

Report or block dingo-d

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View wpgraphql-after-phpcbf.txt
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
----------------------------------------------------------------------
View docker-compose.yaml
version: '3.3'
services:
app:
image: wordpress:5.2.0-php7.2-fpm
container_name: wptest-app
depends_on:
- db
- redis
@dingo-d
dingo-d / composer.json
Created Jul 8, 2019
PHPCS Security scan (for WordPress). This setup can check your project for some possible security issues. It will also check it against the PHPCompatibility standard, WPCS-Extra standard (includes Core), and uses a security audit standard from Pheromone.
View composer.json
{
"require-dev": {
"pheromone/phpcs-security-audit": "^2.0",
"dealerdirect/phpcodesniffer-composer-installer": "^0.5.0",
"roave/security-advisories": "dev-master",
"phpcompatibility/php-compatibility": "^9.2",
"wp-coding-standards/wpcs": "^2.1"
},
"scripts": {
"phpcs-i": "@php vendor/bin/phpcs -i",
View pointers.js
/* global pointerLocalization */
export default class Pointers {
constructor() {
this.pointersList = {};
this.openedPointers = JSON.parse(localStorage.getItem('openedPointers')) || [];
this.openPointer = this.openPointer.bind(this);
this.setLabel = this.setLabel.bind(this);
this.initPointers = this.initPointers.bind(this);
}
@dingo-d
dingo-d / pointer-init.js
Created Dec 13, 2018
Init file for the pointers. Pointers script is located here: https://gist.github.com/dingo-d/a83092146c1660383cb5c3483d71cdab
View pointer-init.js
/* global pointerLocalization */
import Pointers from './pointers';
$(function() {
const pointers = new Pointers();
// Filter the current context pointers
const pointersInContext = Object.values(pointerLocalization.pointers)
.filter((pointer) => pointer.context === pointerLocalization.currentScreen);
View class-pointers.php
<?php
/**
* Pointers manger file
*
* @since 1.0.0
* @package Plugin
*/
namespace Plugin;
@dingo-d
dingo-d / travis-local.txt
Last active Nov 7, 2018
Locally setup travis on docker. Taken from: https://github.com/travis-ci/travis-ci/issues/9709 Used for twentynineteen travis checks.
View travis-local.txt
docker run --name travis-debug -dit travisci/ci-garnet:packer-1512502276-986baf0 /sbin/init
docker exec -it travis-debug bash -l
su - travis
rvm install 2.3.0
rvm use 2.3.0
cd builds
git clone --branch issue_9709_fix https://github.com/ekivolowitz/travis-build.git
cd travis-build
gem install travis
travis # to create ~/.travis
@dingo-d
dingo-d / prevent-duplicates.php
Created Oct 26, 2018
Prevent upload of the same files in media library
View prevent-duplicates.php
<?php
//in media.php class
/**
* Checks if the file with the same name exists in the media library, and renames it if it does
*
* @param array $file An array of data for a single file.
* @return array $file Modified array of data for a single file if the file name is the same.
*/
public function intercept_file_upload( $file ) {
// If, for some odd reason, the file name is empty don't bother with it and let WP handle it.
@dingo-d
dingo-d / font-weight.txt
Created Oct 9, 2018
Font weight number to words
View font-weight.txt
100 - Thin
200 - Extra Light, Ultra Light
300 - Light
400 - Normal, Book, Regular
500 - Medium
600 - Semi Bold, Demi Bold
700 - Bold
800 - Extra Bold, Ultra Bold
900 - Black, Heavy
@dingo-d
dingo-d / permission.php
Created Oct 2, 2018
An example of a custom permission callback
View permission.php
<?php
public function user_get_check( \WP_REST_Request $request ) {
// To avoid CORS issue.
if ( $request->get_method() === 'OPTIONS' ) {
return true;
}
$auth_array = $request->get_headers();
You can’t perform that action at this time.