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
@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
*/
@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"'
@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
@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)
@joepie91
joepie91 / vpn.md
Last active April 20, 2024 21:15
Don't use VPN services.

Don't use VPN services.

No, seriously, don't. You're probably reading this because you've asked what VPN service to use, and this is the answer.

Note: The content in this post does not apply to using VPN for their intended purpose; that is, as a virtual private (internal) network. It only applies to using it as a glorified proxy, which is what every third-party "VPN provider" does.

  • A Russian translation of this article can be found here, contributed by Timur Demin.
  • A Turkish translation can be found here, contributed by agyild.
  • There's also this article about VPN services, which is honestly better written (and has more cat pictures!) than my article.
@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;
}
@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 );
@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 ) );
@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 ",
"_-_-_-_-_-_-_-| /\\_/\\ ",
"-_-_-_-_-_-_-~|__( ^ .^) + + ",
@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";