Skip to content

Instantly share code, notes, and snippets.

View reatlat's full-sized avatar
🖖
Live long and prosper!

Alex Zappa reatlat

🖖
Live long and prosper!
View GitHub Profile
@wpexplorer
wpexplorer / remove-theme-mods-keep-menus
Last active October 29, 2017 22:25
Remove all WordPress theme_mods but keep menu locations
// Get menu locations and save to array
$locations = get_theme_mod( 'nav_menu_locations' );
$save_menus = array();
foreach( $locations as $key => $val ) {
$save_menus[$key] = $val;
}
// Remove all mods
remove_theme_mods();
// Re-add the menus
set_theme_mod( 'nav_menu_locations', array_map( 'absint', $save_menus ) );
@reatlat
reatlat / html-languages.txt
Created December 18, 2017 11:21 — forked from JamieMason/html-languages.txt
HTML lang attribute / ISO language code reference / Culture names
CULTURE SPEC.CULTURE ENGLISH NAME
--------------------------------------------------------------
Invariant Language (Invariant Country)
af af-ZA Afrikaans
af-ZA af-ZA Afrikaans (South Africa)
ar ar-SA Arabic
ar-AE ar-AE Arabic (U.A.E.)
ar-BH ar-BH Arabic (Bahrain)
ar-DZ ar-DZ Arabic (Algeria)
ar-EG ar-EG Arabic (Egypt)
@rdlh
rdlh / nyan-cat-console.js
Created April 22, 2014 20:07
Get the NYAN CAT in your developer console !
var _nyan = 0;
var __nyan = [[
"+ o + o ",
" + o + + ",
"o + ",
" o + + + ",
"+ o o + o ",
"-_-_-_-_-_-_-_,------, o ",
"_-_-_-_-_-_-_-| /\\_/\\ ",
"-_-_-_-_-_-_-~|__( ^ .^) + + ",
@reatlat
reatlat / debug.php
Last active July 24, 2023 23:44
Debug pretty print for PHP
<?php
/**
* Debug pretty print
* @author https://github.com/reatlat
*/
if (!function_exists('php_pretty_print')) :
/**
* Debug helper
* Pretty print the array
*/
@kittenlane
kittenlane / 1-remove-woocommerce-tabs.php
Last active November 30, 2023 20:07
Remove tabs but keep product description in WooCommerce
//* http://gasolicious.com/remove-tabs-keep-product-description-woocommerce/
// Location: add to functions.php
// Output: removes woocommerce tabs
remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_product_data_tabs', 10 );
@wilnaweb
wilnaweb / get_permalink_from_related_content_translated
Last active January 13, 2024 03:52
Function to get the translation link of related Wordpress content with WPML
@candycode
candycode / image-arraybuffer.js
Created March 7, 2014 15:24
Create a jpg image from ArrayBuffer data
// Simulate a call to Dropbox or other service that can
// return an image as an ArrayBuffer.
var xhr = new XMLHttpRequest();
// Use JSFiddle logo as a sample image to avoid complicating
// this example with cross-domain issues.
xhr.open( "GET", "http://fiddle.jshell.net/img/logo.png", true );
// Ask for the result as an ArrayBuffer.
xhr.responseType = "arraybuffer";
@DHS
DHS / PHP Countries Array
Created November 4, 2011 18:51
PHP array of all country names
<?php
$countries = array("Afghanistan", "Albania", "Algeria", "American Samoa", "Andorra", "Angola", "Anguilla", "Antarctica", "Antigua and Barbuda", "Argentina", "Armenia", "Aruba", "Australia", "Austria", "Azerbaijan", "Bahamas", "Bahrain", "Bangladesh", "Barbados", "Belarus", "Belgium", "Belize", "Benin", "Bermuda", "Bhutan", "Bolivia", "Bosnia and Herzegowina", "Botswana", "Bouvet Island", "Brazil", "British Indian Ocean Territory", "Brunei Darussalam", "Bulgaria", "Burkina Faso", "Burundi", "Cambodia", "Cameroon", "Canada", "Cape Verde", "Cayman Islands", "Central African Republic", "Chad", "Chile", "China", "Christmas Island", "Cocos (Keeling) Islands", "Colombia", "Comoros", "Congo", "Congo, the Democratic Republic of the", "Cook Islands", "Costa Rica", "Cote d'Ivoire", "Croatia (Hrvatska)", "Cuba", "Cyprus", "Czech Republic", "Denmark", "Djibouti", "Dominica", "Dominican Republic", "East Timor", "Ecuador", "Egypt", "El Salvador", "Equatorial Guinea", "Eritrea", "Estonia", "Ethiopia", "Falkland Island
@natesubra
natesubra / no_mp.bat
Created May 21, 2020 16:10
Disable Windows Defender - Powershell
# disable
powershell -command 'Set-MpPreference -DisableRealtimeMonitoring $true -DisableScriptScanning $true -DisableBehaviorMonitoring $true -DisableIOAVProtection $true -DisableIntrusionPreventionSystem $true'
# Or exclude
powershell -command 'Add-MpPreference -ExclusionPath "c:\temp" -ExclusionProcess "c:\temp\yourstuffs.exe"'
@mattclements
mattclements / function.php
Last active April 16, 2024 17:04
Wordpress Disable Comments (add to function.php)
<?php
add_action('admin_init', function () {
// Redirect any user trying to access comments page
global $pagenow;
if ($pagenow === 'edit-comments.php') {
wp_redirect(admin_url());
exit;
}