Skip to content

Instantly share code, notes, and snippets.

View beatwiz's full-sized avatar
🥶
#crunching

Gustavo Silva beatwiz

🥶
#crunching
View GitHub Profile
@beatwiz
beatwiz / functions.php
Created March 2, 2023 09:05
Block WP JSON API Get Users
<?php
/**
* Block Users JSON API
*/
add_filter('rest_endpoints', function ($endpoints) {
if (isset($endpoints['/wp/v2/users'])) {
unset($endpoints['/wp/v2/users']);
}
@beatwiz
beatwiz / shell.sh
Last active April 29, 2022 09:09
Convert movie files using ffmpeg on macos (mov to mp4) (dolby vision mkv to mp4 container for LG)
# convert mov to mp4
# https://medium.com/macoclock/convert-mov-to-mp4-on-a-mac-c9c93b730d84
brew install ffmpeg
ffmpeg -i demo.mov -vcodec h264 demo.mp4
# convert DoVi mkv to DoVi mp4
# will only convert first video and audio stream and will skip subtitles
# https://www.reddit.com/r/ffmpeg/comments/qe7oq1/comment/i45kbpy/?utm_source=share&utm_medium=web2x&context=3
ffmpeg -i input.mkv -c copy -strict unofficial output.mp4
@beatwiz
beatwiz / add-gtm-wp.php
Created August 10, 2021 10:55 — forked from jsn789/add-gtm-wp.php
Add Google Tag Manager through functions.php in WordPress
/* Add Google Tag Manager javascript code as close to
the opening <head> tag as possible
=====================================================*/
function add_gtm_head(){
?>
<!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
@beatwiz
beatwiz / woocommerce-duplicate-skus.sql
Created July 21, 2021 08:17 — forked from yanknudtskov/woocommerce-duplicate-skus.sql
Select Duplicate SKUs from WooCommerce Database #woocommerce #mysql
SELECT meta_value
FROM wp_fanatic_shop_postmeta
WHERE meta_key = '_sku'
AND meta_value != ''
GROUP BY meta_value HAVING COUNT(meta_value) > 1
@beatwiz
beatwiz / acf-php-to-json.php
Last active April 29, 2021 05:37 — forked from ollietreend/acf-php-to-json.php
Convert Advanced Custom Fields Pro configuration from PHP to JSON.
<?php
/**
* Plugin Name: Convert ACF PHP to JSON
* Description: Convert Advanced Custom Fields Pro configuration from PHP to JSON.
*/
namespace ConvertAcfPhpToJson;
/**
* Add submenu item under 'Custom Fields'
@beatwiz
beatwiz / mouse_speed.sh
Created August 13, 2020 07:10 — forked from bmarkons/mouse_speed.sh
Boost mouse speed on iMac
# Stolen from here https://www.tylernichols.com/apple/speed-up-mouse-tracking-on-mac-os-x
defaults write -g com.apple.mouse.scaling 6.0
@beatwiz
beatwiz / creative-cloud-disable.md
Created August 13, 2020 07:02 — forked from andreibosco/creative-cloud-disable.md
disable creative cloud startup on mac
@beatwiz
beatwiz / readme.md
Last active September 4, 2019 21:14
Permanent Facebook Page Access Token

1) Create a new APP if needed

Default permissions, just need an APP id / APP secret

2) On the Facebook Graph API Explorer

https://developers.facebook.com/tools/explorer/

i) Choose the correct APP, and click on Get Token > Get User Access Token

ii) Copy the returned token

@beatwiz
beatwiz / functions.php
Created August 21, 2019 14:55
Hide DIVI Projects CPT
<?php
/**
* This will hide the Divi "Project" post type.
* Thanks to georgiee (https://gist.github.com/EngageWP/062edef103469b1177bc#gistcomment-1801080) for his improved solution.
*/
add_filter( 'et_project_posttype_args', 'mytheme_et_project_posttype_args', 10, 1 );
function mytheme_et_project_posttype_args( $args ) {
return array_merge( $args, array(
'public' => false,
'exclude_from_search' => false,
@beatwiz
beatwiz / sheet.md
Last active August 10, 2019 16:36
Laravel + Nova Cheat Sheet

New Laravel Model (With Controller and Migration)

php artisan make:model Status -a

New Nova Card

php artisan nova:card provider/nova-clock

New Nova Value

php artisan nova:value NewCommits

New Nova Trend