Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Ihor Mukovoz themkvz

🎯
Focusing
View GitHub Profile
@miniMAC
miniMAC / functions.php
Created Dec 20, 2018
Fix WooCommerce orders list bug + WordPress 5.0.2
View functions.php
// FIX WooCommerce orders list bug
function fix_query_args_woo_orders( $query_args ) {
if ( isset( $query_args['post_status'] ) &&
empty( $query_args['post_status'] ) ) {
unset( $query_args['post_status'] );
}
return $query_args;
}
@rohankhudedev
rohankhudedev / opcache.ini
Last active Dec 1, 2022
Best Zend OpCache Settings / Tuning / Configurations
View opcache.ini
[opcache]
; Determines if Zend OPCache is enabled
opcache.enable=1
; Determines if Zend OPCache is enabled for the CLI version of PHP
;opcache.enable_cli=1
; The OPcache shared memory storage size.
opcache.memory_consumption=512
@andrewlimaza
andrewlimaza / example.html
Created Dec 19, 2016
Print certain div / elements using window.print()
View example.html
<script>
function printDiv(divName){
var printContents = document.getElementById(divName).innerHTML;
var originalContents = document.body.innerHTML;
document.body.innerHTML = printContents;
window.print();
document.body.innerHTML = originalContents;
@lots0logs
lots0logs / child-functions-php-snippet.php
Last active Apr 19, 2020
WordPress :: Divi Theme :: Include Tags In Post Meta When Displayed On Frontend
View child-functions-php-snippet.php
<?php
/* DON'T copy the first line (above) if your functions.php already has it.
* ----------------------------------------------------------------------- */
function et_pb_postinfo_meta( $postinfo, $date_format, $comment_zero, $comment_one, $comment_more ){
$postinfo_meta = '';
if ( in_array( 'author', $postinfo ) )
$postinfo_meta .= ' ' . esc_html__( 'by', 'et_builder' ) . ' <span class="author vcard">' . et_pb_get_the_author_posts_link() . '</span>';
if ( in_array( 'date', $postinfo ) ) {
if ( in_array( 'author', $postinfo ) ) $postinfo_meta .= ' | ';
@julianxhokaxhiu
julianxhokaxhiu / pagespeed_optimize_images.sh
Last active Nov 7, 2022
Recursively optimize all PNG and JPG files wherever they are from the script position and inner ( based on OPTING, PNGCRUSH, ADVANCECOMP and JPEGOPTIM )
View pagespeed_optimize_images.sh
#!/bin/bash
# Improved as per feedback from @pascal - https://gist.github.com/julianxhokaxhiu/c0a8e813eabf9d6d9873#gistcomment-3086462
find . -type f -iname "*.png" -exec optipng -nb -nc {} \;
find . -type f -iname "*.png" -exec advpng -z4 {} \;
find . -type f -iname "*.png" -exec pngcrush -rem gAMA -rem alla -rem cHRM -rem iCCP -rem sRGB -rem time -ow {} \;
find . -type f \( -iname "*.jpg" -o -iname "*.jpeg" \) -exec jpegoptim -f --strip-all {} \;
@denji
denji / nginx-tuning.md
Last active Dec 2, 2022
NGINX tuning for best performance
View nginx-tuning.md

Moved to git repository: https://github.com/denji/nginx-tuning

NGINX Tuning For Best Performance

For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.

Generally, properly configured nginx can handle up to 400K to 500K requests per second (clustered), most what i saw is 50K to 80K (non-clustered) requests per second and 30% CPU load, course, this was 2 x Intel Xeon with HyperThreading enabled, but it can work without problem on slower machines.

You must understand that this config is used in testing environment and not in production so you will need to find a way to implement most of those features best possible for your servers.

@bgallagh3r
bgallagh3r / wp.sh
Last active Aug 24, 2022
Wordpress: Bash Install Script -- Downloads latest WP version, updates wp-config with user supplied DB name, username and password, creates and CHMOD's uploads dir, copies all the files into the root dir you run the script from, then deletes itself!
View wp.sh
#!/bin/bash -e
clear
echo "============================================"
echo "WordPress Install Script"
echo "============================================"
echo "Database Name: "
read -e dbname
echo "Database User: "
read -e dbuser
echo "Database Password: "