This file contains 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 | |
// Place this code in wp-content/mu-plugins/docketcache_flush_every_hour.php | |
add_action('docketcache/init', function($docket_cache_instance) { | |
$docket_cache = $docket_cache_instance; | |
add_action('docketcache_flush_every_hour', function() use($docket_cache) { | |
$result = $docket_cache->flush_cache(true); | |
$docket_cache->co()->lookup_set('occacheflushed', $result); | |
do_action('docketcache/action/flush/objectcache', $result); | |
}); |
This file contains 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
#!/bin/bash | |
FIFO="/path-to-ss_cmd.txt"; | |
LIST="$(sort -u $FIFO)"; | |
for CMD in $LIST; do | |
$CMD | |
done | |
rm $FIFO; |
This file contains 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 | |
// Exec | |
// call: do_action('ss_cmd', 'cmd1'); | |
add_action('ss_cmd', function($cmd) { | |
switch($cmd) { | |
case 'cmd1': | |
return shell_exec('cmd1'); | |
break; | |
case 'cmd2': |
This file contains 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 | |
/** | |
* Reference/source: http://stackoverflow.com/a/1464155/933782 | |
* | |
* I want a short alphanumeric hash that’s unique and who’s sequence is difficult to deduce. | |
* I could run it out to md5 and trim the first n chars but that’s not going to be very unique. | |
* Storing a truncated checksum in a unique field means that the frequency of collisions will increase | |
* geometrically as the number of unique keys for a base 62 encoded integer approaches 62^n. | |
* I’d rather do it right than code myself a timebomb. So I came up with this. | |
* |
This file contains 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('plugins_loaded', function() { | |
if ( is_multisite() ) { | |
$sites = get_sites(); | |
foreach ( $sites as $site ) { | |
switch_to_blog( $site->blog_id ); | |
$old_siteurl = get_option('siteurl'); | |
$old_homeurl = get_option('home'); | |
$new_siteurl = str_replace('http://', 'https://', $old_siteurl); |
This file contains 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
/* | |
1) Open https://popcat.click | |
2) Open console (F12) | |
3) Insert code | |
*/ | |
function run_pcat() { | |
var event = new KeyboardEvent( 'keydown', { | |
key: 'g', | |
ctrlKey: true |
This file contains 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_filter('gettext', function($translation, $text, $domain) { | |
if(is_admin()) { | |
return $translation; | |
} | |
if($domain == 'mythemedomain') { | |
if(function_exists('icl_register_string')){ | |
$slug = sanitize_title($text); | |
icl_register_string($domain, $slug, $text); |
This file contains 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_filter( 'comment_form_defaults', function($defaults) { | |
$defaults[ 'fields' ][ 'url' ] = '<p class="comment-form-url"><label for="url">Website <span class="required">*</span></label> <input id="url" name="url" type="text" value="" size="30" maxlength="200" required="required" /></p>';\ | |
return $defaults; | |
}, PHP_INT_MAX); |
This file contains 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
# apache | |
Header set Referrer-Policy strict-origin-when-cross-origin | |
Header set Content-Security-Policy 'report-uri /csp-report-parser;' | |
Header set Feature-Policy "payment 'self'; sync-xhr 'self' https://iszuddinismail.com" | |
Header set Permissions-Policy "payment=(self),sync-xhr=(self 'https://iszuddinismail.com')" | |
# nginx | |
# rc letak dalam etc/nginx-rc/extra.d/[APPNAME].headers.0.conf | |
add_header Content-Security-Policy "report-uri /csp-report-parser"; | |
add_header Referrer-Policy "strict-origin-when-cross-origin"; |
This file contains 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 Version 5.4.30 | |
-------------------------------------------------- | |
Testing 10 item array over 1,000 iterations: | |
serialize 2.1979808807373 ms | |
json_encode 1.3420581817627 ms | |
var_export 1.9409656524658 ms | |
msgpack_pack 1.5850067138672 ms | |
-------------------------------------------------- |