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 / wp-featured-image-upload-for-front-end.php
Created January 23, 2017 00:12 — forked from juyal-ahmed/wp-featured-image-upload-for-front-end.php
Upload featured image on custom post from WordPress front-end
@beatwiz
beatwiz / gist:f1d95582d58b51a41c1e723611d15f83
Created February 15, 2017 14:26 — forked from jaredatch/gist:7f0aa8eefe19a3a937b1
Extract YouTube ID from URL
<?php
/**
* Fetch YouTube ID from URLs
*
* @param string $url
* @return string
*/
function ja_youtube_id( $url ){
$regex = '~(?:http|https|)(?::\/\/|)(?:www.|)(?:youtu\.be\/|youtube\.com(?:\/embed\/|\/v\/|\/watch\?v=|\/ytscreeningroom\?v=|\/feeds\/api\/videos\/|\/user\S*[^\w\-\s]|\S*[^\w\-\s]))([\w\-]{11})[a-z0-9;:@#?&%=+\/\$_.-]*~i';
$id = preg_replace( $regex, '$1', $url );
@beatwiz
beatwiz / Kernel.php
Created September 21, 2017 14:06 — forked from davidrushton/Kernel.php
Laravel 5 Database Queue - Shared Hosting
<?php
namespace App\Console;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
class Kernel extends ConsoleKernel
{
/**
@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 / 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 / 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 / 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 / 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=