Skip to content

Instantly share code, notes, and snippets.

View pmventura's full-sized avatar
🎯
Focusing

Paul Ventura pmventura

🎯
Focusing
View GitHub Profile
@wojteklu
wojteklu / clean_code.md
Last active November 18, 2024 16:37
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

@Harti
Harti / Searchable
Last active March 13, 2020 21:24
Overriding trait for laravel/scout's Searchable trait, to hide unpublished instances from the search
<?php
namespace App\Models\Traits;
use Illuminate\Support\Collection;
trait Searchable
{
use \Laravel\Scout\Searchable;
@jasonbahl
jasonbahl / order-by-acf-like-count.php
Last active July 10, 2024 20:41
Shows how to add a custom order value to a connection to order by a custom field.
add_filter( 'graphql_PostObjectsConnectionOrderbyEnum_values', function( $values ) {
$values['LIKE_COUNT'] = [
'value' => 'like_count',
'description' => __( 'The number of likes on the post', 'wp-graphql' ),
];
return $values;
} );