Skip to content

Instantly share code, notes, and snippets.

View namncn's full-sized avatar

Nam Truong namncn

View GitHub Profile
@namncn
namncn / waziper.js
Created July 27, 2025 16:40
Waziper - How to fix QR code not working:
Updated package.json:
{
"dependencies": {
"@whiskeysockets/baileys": "^6.7.18",
"pino": "^8.0.0",
"axios": "^1.3.6",
"cors": "^2.8.5",
"express": "^4.18.2",
"ip": "^1.1.8",
@namncn
namncn / Redis Object Cache Pro - High Performance Configuration (For expert users only.)
Last active August 4, 2025 05:13
Redis Object Cache Pro - Recommended Configuration
define('WP_REDIS_CONFIG', [
'token' => 'e279430effe043b8c17d3f3c751c4c0846bc70c97f0eaaea766b4079001c',
'host' => '127.0.0.1',
'port' => 6379,
'database' => 1, // change for each site
'timeout' => 0.5,
'read_timeout' => 0.5,
'retry_interval' => 10,
'maxttl' => 3600 * 24,
'retries' => 3,
@namncn
namncn / InstallerService.php
Created October 1, 2024 18:09
- resources/views/installer/license.blade.php - app/Services/InstallerService.php
<?php
namespace App\Services;
use App\Libraries\AppLibrary;
use Dipokhalder\EnvEditor\EnvEditor;
use Exception;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Artisan;
@namncn
namncn / functions.php
Last active January 12, 2024 17:40
Bật mặc định cho phép đánh giá của WooCommerce
<?php
// Dán đoạn code dưới đây vào file functions.php của theme
function sharexcode_set_reviews_allowed( $product ) {
$product->set_reviews_allowed( true );
}
add_action( 'woocommerce_admin_process_product_object', 'sharexcode_set_reviews_allowed', 99999 );
@namncn
namncn / functions.php
Created December 11, 2022 02:54
How to get taxonomy/category direct children only
<?php
$args = array(
'taxonomy' => 'product_cat', // truyền category/custom taxonomy name vào đây.
'parent' => get_queried_object_id(),
);
$getterms = get_terms( $args );
How to Fix Could not get lock /var/lib/dpkg/lock Error on UbuntuHow to Fix Could not get lock /var/lib/dpkg/lock Error on Ubuntu
sudo kill -9 8808
sudo dpkg --configure -a
@namncn
namncn / .htaccess
Last active December 9, 2022 18:15
Hướng dẫn chuyển hướng (.htaccess Redirect 301) tên miền cũ sang tên miền mới
# Hướng dẫn tại: https://namncn.com/chua-phan-loai/huong-dan-chuyen-huong-htaccess-redirect-301-ten-mien-cu-sang-ten-mien-moi/
RewriteEngine On
RewriteCond %{HTTP_HOST} ^tenmiencu.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.tenmiencu.com$
RewriteRule ^(.*)$ https://tenmienmoi.com/$1 [R=301,L]
@namncn
namncn / allow-svg-upload-in-wordpress-media.php
Created February 5, 2021 02:50
Allow SVG File Uploads In WordPress Media / Enable SVG Support in WordPress
<?php
/**
* Add svg support
*
*/
add_filter( 'wp_check_filetype_and_ext', function( $data, $file, $filename, $mimes) {
global $wp_version;
if( $wp_version == '4.7' || ( (float) $wp_version < 4.7 ) ) {
return $data;
}
<div class="post-thumb">
<img src="https://i.imgur.com/iCMEVjr.jpg" alt="Norway">
</div>
.post-thumb {
position: relative;
height:0;
padding-bottom: 56.25%; // Điền % bạn cần.
}