Skip to content

Instantly share code, notes, and snippets.

@PhongGCS
PhongGCS / nginx.conf
Created September 26, 2024 08:36
Wordpress Rewrite Nginx protect hacker
############ WordPress ####################
# Disable logging for favicon and robots.txt
location = /favicon.ico {
try_files /favicon.ico @empty;
access_log off;
log_not_found off;
expires max;
}
@PhongGCS
PhongGCS / s3cloud.asia
Created July 22, 2024 16:41
s3cloud.asia minio nginx
server
{
listen 80;
listen 443 ssl http2;
listen [::]:443 ssl http2;
listen [::]:80;
server_name s3cloud.asia;
index index.php index.html index.htm default.php default.htm default.html;
root /www/wwwroot/s3cloud.asia;
@PhongGCS
PhongGCS / gist:23f44147a52c92f27c79dec70f7e7047
Last active March 21, 2024 05:56
Woo commerce CRUD product
<?php
class CRUDProduct {
public function sync_product($item){
$args = array(
'post_type' => 'product',
'post_status' => 'publish',
'posts_per_page' => 1,
'p' => $item['id'],
);
@PhongGCS
PhongGCS / gist:1614b5f7dcb7baa0b780e99473d58e22
Created September 29, 2023 03:12
Entity Manager Spring boot
public Page<String> getSmsCampaignRecepientByCampaignId(SmsCampaignRecepientQueryRequest request, Pageable pageable) {
int pageNumber = pageable.getPageNumber();
int pageSize = pageable.getPageSize();
StringBuilder sql = new StringBuilder();
StringBuilder sqlCount = new StringBuilder();
sql.append("SELECT phone_number FROM sms_campaign_recepient WHERE sms_campaign_id = :smsCampaignId ");
// Check if isPhoneVN is specified in the request
if (request.getIsPhoneVN() != null) {
@PhongGCS
PhongGCS / gist:a5e8269ac291b5267fd9fa1357222922
Created September 14, 2023 03:03
SQL when move wordpress to new url
UPDATE wp_options SET option_value = replace(option_value, 'nrgasia.gg', 'gam.gg') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET guid = replace(guid, 'nrgasia.gg','gam.gg');
UPDATE wp_posts SET post_content = replace(post_content, 'nrgasia.gg', 'gam.gg');
UPDATE wp_postmeta SET meta_value = replace(meta_value,'nrgasia.gg','gam.gg');
### 1. Add style.css assets/main.js child theme
### 2. Add % giảm giá của sản phẩm
### 3. Thêm fontawesome
### 4. Thêm Theme Option ACF
### 5. Tạo Taxonomy
### 6. Lấy danh sách taxonomy theo post id (product id)
### 7. Add font face
### 8. Style accordion minus plus icon
### 9. Change Icon slider flatsome
### 10. Conver dot flatsome slider to number
@PhongGCS
PhongGCS / gist:abe8c9693b9cca3ab785d999104d7110
Created January 25, 2022 13:24
wordpress nginx config
server {
# Ports to listen on, uncomment one.
listen 443 ssl http2;
listen [::]:443 ssl http2;
# Server name to listen for
server_name mmhome.vn;
# Path to document root
root /var/www/html/web
@PhongGCS
PhongGCS / gist:178fbcb40b6e926718129b072ec6bf03
Last active October 26, 2021 08:15
Pagination ajax for wordpress
function pagination(url) {
let html = jQuery.get(url)
html.done( (res) => {
let elements = jQuery(res);
let found = jQuery('#main', elements);
let child = found.children();
jQuery('#main').empty();
jQuery('#main').append(child)
@PhongGCS
PhongGCS / gist:e70e8e91f9d79d4fd806034ef4511aa9
Created October 25, 2021 05:41
Get all url of site by Javascript
javascript: (function() {
output = '<html><head><title>SEO SERP Extraction Tool</title><style type=\'text/css\'>body,table{font-family:Tahoma,Verdana,Segoe,sans-serif;font-size:11px;color:#000}h1,h2,th{color:#405850}th{text-align:left}h2{font-size:11px;margin-bottom:3px}</style></head><body>';
output += '<table><tbody><tr><td><a href=\'https://bit.ly/congdongseotool\'><img src=\'https://kieuhaiseo.com/IMG/FB-banner.png\'></a></td><td><h1>SEO SERP Extraction Tool</h1></td></tr></tbody></table>';
pageAnchors = document.getElementsByTagName('a');
divClasses = document.getElementsByTagName('div');
var linkcount = 0;
var linkLocation = '';
var linkAnchorText = '';
output += '<table><th>ID</th><th>Link</th><th>Anchor</th>';
for (i = 0; i < pageAnchors.length; i++) {
/// Create new user have role owner with db
> mongo admin --username root --password <pwd>
> use prod
> db.createUser(
{
user: "prod",
pwd: "<pwd>",
roles: [ { role: "dbOwner", db: "prod" } ]