Skip to content

Instantly share code, notes, and snippets.

View alinademi's full-sized avatar

Ali Demi alinademi

  • Vancouver
View GitHub Profile
@alinademi
alinademi / .php-cs-fixer.php
Created May 30, 2022 15:07 — forked from laravel-shift/.php-cs-fixer.php
PHP CS Fixer - Laravel Coding Style Ruleset
<?php
use PhpCsFixer\Config;
use PhpCsFixer\Finder;
$rules = [
'array_indentation' => true,
'array_syntax' => ['syntax' => 'short'],
'binary_operator_spaces' => [
'default' => 'single_space',

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:

@alinademi
alinademi / block-hi-test.php
Created May 16, 2022 23:29 — forked from pdclark/block-hi-test.php
The shortest possible example PHP-rendered WordPress block.
<?php
/**
* Plugin Name: Block — Hi Test
* Description: The shortest possible example PHP-rendered WordPress block.
* Author: Paul Clark
* Author URI: https://pdclark.com
*
* @package hi
*/
@alinademi
alinademi / block-pods.php
Created May 16, 2022 23:28 — forked from pdclark/block-pods.php
Gutenberg block to wrap the `[pods]` shortcode.
<?php
/**
* Plugin Name: Pods — Block
* Description: Gutenberg block to wrap the `[pods]` shortcode.
* Author: Paul Clark
* Author URI: https://pdclark.com
* Plugin URI: https://pd.cm/pods-block
* Version: 28
*
* @package pd
@alinademi
alinademi / pd-blocks-example-oop.php
Created May 16, 2022 23:26 — forked from pdclark/pd-blocks-example-oop.php
Short example OOP PHP-rendered WordPress blocks with attributes.
<?php
/**
* Plugin Name: PD Blocks — Example OOP with attributes
* Description: Single-file OOP PHP-rendered WordPress blocks with 5 example blocks.
* Author: Paul David Clark
* Author URI: https://pd.cm
* Plugin URI: https://pd.cm/oop-blocks
* Version: 30
*
* @package pd
@alinademi
alinademi / custom.json
Created May 15, 2022 18:12 — forked from alexciarlillo/custom.json
VSCode customizations for Nord color theme
// color customizations for Nord
"editor.tokenColorCustomizations": {
"textMateRules": [
{
"settings": {
"foreground": "#d1d5dc",
"background": "#2f343f"
}
},
{
<?php
add_filter( 'the_content', 'crd_append_post_links' );
function crd_append_post_links( $content ) {
if ( is_page() ) {
$post_links_data = get_post_meta( get_the_ID() );
if ( isset( $post_links_data[ 'blog_group' ][ 0 ] ) ) {
$blog_list = maybe_unserialize( $post_links_data[ 'blog_group' ][ 0 ] );
$posts_list = '<ul>';
foreach ( $blog_list as $post_info ) {
@alinademi
alinademi / vim-shortcuts.md
Created April 4, 2022 04:58 — forked from tuxfight3r/vim-shortcuts.md
VIM SHORTCUTS

VIM KEYBOARD SHORTCUTS

MOVEMENT

h        -   Move left
j        -   Move down
k        -   Move up
l        -   Move right
$        -   Move to end of line
0        -   Move to beginning of line (including whitespace)
@alinademi
alinademi / review-checklist.md
Created March 10, 2022 00:09 — forked from bigsergey/review-checklist.md
Front-end Code Review Checklist

Review checklist

General

  1. Does the code work?
  2. Description of the project status is included.
  3. Code is easily understand.
  4. Code is written following the coding standarts/guidelines (React in our case).
  5. Code is in sync with existing code patterns/technologies.
  6. DRY. Is the same code duplicated more than twice?
@alinademi
alinademi / clean_code.md
Created February 18, 2022 23:43 — forked from wojteklu/clean_code.md
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules