Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Luca Grandicelli lucagrandicelli

🏠
Working from home
View GitHub Profile
@lucagrandicelli
lucagrandicelli / register-cpt-yarpp.php
Created Oct 24, 2018
How to register a Custom Post Type with the YARPP (Yet Another Related Posts Plugin) in Wordpress
View register-cpt-yarpp.php
<?php
/**
* This is the method to register a custom post type adding YARPP support in it.
*
* @param $data array The original CPT args.
* @param $post_type string The CPT slug.
*
* @return array
*/
function register_my_cpt() {
@lucagrandicelli
lucagrandicelli / enable-yarpp-cpt-toolset.php
Created Oct 24, 2018
How to enable YARPP (Yet Another Related Posts Plugin) support for Toolset's Custom Post Types.
View enable-yarpp-cpt-toolset.php
<?php
/**
* Enable YARPP support for Toolset's Custom Post Types
*
* @param $data array The CPT args.
* @param $post_type array The registered CPT list.
*
* @return array
*/
function yarpp_support_func($data, $post_type) {
@lucagrandicelli
lucagrandicelli / remove-emojis-wordpress.php
Last active Jul 13, 2020
A little gist to remove any emoji reference from Wordpress.
View remove-emojis-wordpress.php
<?php
/**
* Disabling emoji library from Wordpress.
*/
function disable_emojis() {
// Let's remove a bunch of actions & filters.
remove_action( 'wp_head', 'print_emoji_detection_script', 7 );
remove_action( 'admin_print_scripts', 'print_emoji_detection_script' );
remove_action( 'wp_print_styles', 'print_emoji_styles' );
@lucagrandicelli
lucagrandicelli / laravel8-api-web-exception-handler.php
Last active Mar 10, 2021
Laravel 8 API/Web Exception Handler
View laravel8-api-web-exception-handler.php
<?php
/**
* Register the exception handling callbacks for the application.
*
* @return void
*/
public function register()
{
$this->reportable(function (Throwable $e) {});
@lucagrandicelli
lucagrandicelli / wsl2-memory-cap-docker-settings
Last active Oct 23, 2021
WSL Memory Cap - Limit CPU/Memory When using Docker
View wsl2-memory-cap-docker-settings
# turn off all wsl instances such as docker-desktop
wsl --shutdownnotepad "$env:USERPROFILE/.wslconfig"
[wsl2]
memory=3GB # Limits VM memory in WSL 2 up to 3GB
processors=4 # Makes the WSL 2 VM use two virtual processors
#credits: https://itnext.io/wsl2-tips-limit-cpu-memory-when-using-docker-c022535faf6f