Skip to content

Instantly share code, notes, and snippets.

View jinsley8's full-sized avatar

Jon Insley jinsley8

View GitHub Profile
@gaquino
gaquino / gist:87bdf0e6e852e445c0489379d3e9732a
Last active April 21, 2025 20:35
MacOS (xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools))
If you are facing an error like that on new MacOS version.
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
It means that you need to install XCode command line, open a Terminal and run this command:
$ xcode-select --install
Note:
If you want to download and install Command Line tools manually, it can be downloaded from: https://developer.apple.com/download/more/
@ibraheem4
ibraheem4 / postgres-brew.md
Last active April 19, 2025 14:27 — forked from sgnl/postgres-brew.md
Installing Postgres via Brew (OSX)

Installing Postgres via Brew

Pre-Reqs

Brew Package Manager

In your command-line run the following commands:

  1. brew doctor
  2. brew update
@lukecav
lukecav / functions.php
Created September 15, 2017 19:59
Bypass logout confirmation in WooCommerce
function wc_bypass_logout_confirmation() {
global $wp;
if ( isset( $wp->query_vars['customer-logout'] ) ) {
wp_redirect( str_replace( '&', '&', wp_logout_url( wc_get_page_permalink( 'myaccount' ) ) ) );
exit;
}
}
add_action( 'template_redirect', 'wc_bypass_logout_confirmation' );
@brianleejackson
brianleejackson / gp-yoast-seo-cdn.php
Last active March 14, 2018 02:00
gp-yoast-seo-cdn
function wpseo_cdn_filter( $uri ) {
return str_replace( 'https://domain.com', 'https://cdn.domain.com', $uri );
}
add_filter( 'wpseo_xml_sitemap_img_src', 'wpseo_cdn_filter' );
@eyecatchup
eyecatchup / node-cms.md
Last active December 20, 2024 16:11
[WIP] List of Node-based content management systems (CMS)
@fgilio
fgilio / axios-catch-error.js
Last active February 27, 2025 05:50
Catch request errors with Axios
/*
* Handling Errors using async/await
* Has to be used inside an async function
*/
try {
const response = await axios.get('https://your.site/api/v1/bla/ble/bli');
// Success 🎉
console.log(response);
} catch (error) {
// Error 😨
@kocisov
kocisov / next_nginx.md
Last active February 3, 2025 07:27
How to setup next.js app on nginx with letsencrypt
/**
* @Title: Woocommerce Add a product to the cart programmatically
* @Author: Mina Pansuriya
* @Website: http://minapansuriya.com
* @Blog URL: http://minapansuriya.com/woocommerce-add-a-product-to-the-cart-programmatically/
*/
add_action( 'template_redirect', 'pbs_woo_add_gift_product_to_the_cart' );
function pbs_woo_add_gift_product_to_the_cart() {
$isAddGiftF = false;
@LoyEgor
LoyEgor / gulpfile.js
Last active March 13, 2023 17:22
best image compression settings (gulp-imagemin)
// install
// npm i gulp-cache gulp-imagemin imagemin-pngquant imagemin-zopfli imagemin-mozjpeg imagemin-giflossy -f
// node node_modules/jpegtran-bin/lib/install.js
// node node_modules/gifsicle/lib/install.js
// node node_modules/zopflipng-bin/lib/install.js
// node node_modules/mozjpeg/lib/install.js
// node node_modules/giflossy/lib/install.js
// node node_modules/pngquant-bin/lib/install.js
@llgruff
llgruff / How to detect if a WordPress plugin is active.php
Last active October 25, 2022 09:29
A function you can use to check if plugin is active/loaded for your plugins/themes
<?php
/**
* Detect if a WordPress plugin is active
* A function you can use to check if plugin is active/loaded for your plugins/themes
* @link //gist.github.com/llgruff/c5666bfeded5de69b1aa424aa80cc14f
*/
// When coding plugins that rely on another one, like Private Content for bbPress or Visual Attributes for WooCommerce, you need to make if the WordPress Plugin is active to initialize your plugin routines or display a notice saying that the required plugin must be activated. In this tutorial we’ll see how to detect whether a certain plugin is active in a couple of ways.
## 1. Check whether a certain class or function or constant exists