Skip to content

Instantly share code, notes, and snippets.

View lucagrandicelli's full-sized avatar
🎯
Focusing

Luca Grandicelli lucagrandicelli

🎯
Focusing
View GitHub Profile
@lucagrandicelli
lucagrandicelli / wsl2-memory-cap-docker-settings
Last active October 19, 2023 14:51
WSL Memory Cap - Limit CPU/Memory When using Docker
# 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
@lucagrandicelli
lucagrandicelli / laravel8-api-web-exception-handler.php
Last active March 10, 2021 10:29
Laravel 8 API/Web Exception Handler
<?php
/**
* Register the exception handling callbacks for the application.
*
* @return void
*/
public function register()
{
$this->reportable(function (Throwable $e) {});
@lucagrandicelli
lucagrandicelli / remove-emojis-wordpress.php
Last active July 13, 2020 21:24
A little gist to remove any emoji reference from Wordpress.
<?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 / enable-yarpp-cpt-toolset.php
Created October 24, 2018 11:14
How to enable YARPP (Yet Another Related Posts Plugin) support for Toolset's Custom Post Types.
<?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 / register-cpt-yarpp.php
Created October 24, 2018 11:08
How to register a Custom Post Type with the YARPP (Yet Another Related Posts Plugin) in Wordpress
<?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() {