Skip to content

Instantly share code, notes, and snippets.

View ramiwds's full-sized avatar
💭
🎸

rami ramiwds

💭
🎸
  • https://github.com/WebDevStudios
  • ZZ-9 Plural Z Alpha
View GitHub Profile
{
// Place your snippets for php here. Each snippet is defined under a snippet name and has a prefix, body and
// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the
// same ids are connected.
// Example:
// "Print to console": {
// "prefix": "log",
// "body": [
// "console.log('$1');",
@ramiwds
ramiwds / gist:563b667739696e1ead747ab70df6bf67
Last active January 18, 2024 20:03
lead-engineer-review-checklist

Lead Engineer Code Review Checklist

General

  • Effective use of guard clauses to prevent unaccounted conditions from proceeding in a method
  • No vague variable names.
  • Reward brevity.
  • Is this the least amount of code possible to accomplish the goal?

Interpersonal

  • Don't allow anything upstream which is below-quality, even if it's legacy code. The exceptions being that the it's third-party, the time to refactor isn't reasonable, or the file spans numerous concerns and isn't practical to refactor.
  • If you don't know the engineer yet, err on the side of politeness and don't assume they have a thick skin forged from years in open-source.
@IlanVivanco
IlanVivanco / cache.php
Last active December 30, 2024 09:19
Clear all possible WP cache systems
<?php
if ( ! function_exists( 'lets_clear_cache' ) ) {
function lets_clear_cache() {
// WP Rocket
if ( function_exists( 'rocket_clean_domain' ) ) {
rocket_clean_domain();
}
// W3 Total Cache : w3tc

Setting Up WordPress Coding Standards with VSCode

Install WordPress Coding Standards (WPCS)

First, make sure you have Composer installed in your system.

In order to use the WPCS you'll need the PHP_CodeSniffer (PHPCS) and the WPCS rules (sniffs) installed.

You can install PHP_CodeSniffer globally using Composer by running this command:

@ramiabraham
ramiabraham / gethooks
Last active December 26, 2024 21:30
Copy all actions and filters in a plugin and save to a file.
#!/bin/bash
#
# Prints all hooks in a dir to a .log file.
#
# Permissions issues:
# run: chmod +x gethooks
#
# gist: https://gist.github.com/ramiabraham/e8356e00130351ddcbe2c62125e6c52a
#
# Easy usage:
@panych
panych / enable_drafts_parents
Created February 4, 2013 10:44
Wordpress. Allow to set draft page as a parent page
/*
* Allow to set draft page as a parent page
*/
add_filter( 'page_attributes_dropdown_pages_args', 'enable_drafts_parents' );
add_filter( 'quick_edit_dropdown_pages_args', 'enable_drafts_parents' );
function enable_drafts_parents( $args ) {
$args['post_status'] = 'draft,publish,pending';
return $args;
}