Skip to content

Instantly share code, notes, and snippets.

View duongthanhthai's full-sized avatar
💭
Freelancer Full time

Dương Thành Thái duongthanhthai

💭
Freelancer Full time
View GitHub Profile

Keybase proof

I hereby claim:

  • I am duongthanhthai on github.

  • I am thaidt (https://keybase.io/thaidt) on keybase.

  • I have a public key ASDms42wpi-XFcUZduIm_mpzRNM4Apf8tu8YYYfag7HY_Qo

@duongthanhthai
duongthanhthai / .htaccess
Created October 25, 2019 09:13
Compress resources with deflate to reduce the number of bytes sent over the network.
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript
</IfModule>
@duongthanhthai
duongthanhthai / functions.php
Created October 25, 2019 09:14
Add rel attribute to Wordpress galleries created with a shortcode so they use a lightbox (ColorBox used in example)
add_filter('wp_get_attachment_link', 'cb_add_rel_attribute');
function cb_add_rel_attribute($link) {
global $post;
return str_replace('<a href', '<a rel="lightbox" href', $link);
}
@duongthanhthai
duongthanhthai / shortcode
Created October 25, 2019 09:18
Use a WordPress shortcode from within a template
<?php echo do_shortcode("[shortcode]"); ?>
#!/usr/bin/bash
SERVER_NAME=Folder_Google
TIMESTAMP=$(date +"%F")
BACKUP_DIR="/root/backup/$TIMESTAMP"
MYSQL_USER="root" #User Global Database
MYSQL_PASSWORD="Password" #Password Global database
MYSQL=/usr/bin/mysql
MYSQLDUMP=/usr/bin/mysqldump
SECONDS=0
mkdir -p "$BACKUP_DIR/mysql"
@duongthanhthai
duongthanhthai / remove-all-non-alphanumeric.php
Last active November 6, 2021 09:37
Remove all non-alphanumeric in file name images WordPress, add this code to functions.php
function wpartisan_sanitize_file_name( $filename ) { $sanitized_filename = remove_accents( $filename ); // Convert to ASCII
$invalid = array( ' ' => '-', '%20' => '-', '_' => '-', );
$sanitized_filename = str_replace( array_keys( $invalid ), array_values( $invalid ), $sanitized_filename );
$sanitized_filename = preg_replace('/[^A-Za-z0-9-\. ]/', '', $sanitized_filename); // Remove all non-alphanumeric except .
$sanitized_filename = preg_replace('/\.(?=.*\.)/', '', $sanitized_filename); // Remove all but last .
$sanitized_filename = preg_replace('/-+/', '-', $sanitized_filename); // Replace any more than one - in a row
$sanitized_filename = str_replace('-.', '.', $sanitized_filename); // Remove last - if at the end
$sanitized_filename = strtolower( $sanitized_filename ); // Lowercase return $sanitized_filename;
}
add_filter( 'sanitize_file_name', 'wpartisan_sanitize_file_name', 10, 1 );
@duongthanhthai
duongthanhthai / functions.php
Created October 25, 2019 09:18
Remove default admin dashboard widgets (Activity, WordPress News, Quick Draft and At a Glance) from the WordPress admin dashboard for all users.
function remove_dashboard_meta() {
remove_meta_box( 'dashboard_activity', 'dashboard', 'normal' ); // Activity
remove_meta_box( 'dashboard_primary', 'dashboard', 'normal' ); // WordPress News
remove_meta_box( 'dashboard_quick_press', 'dashboard', 'side' ); // Quick Draft
remove_meta_box( 'dashboard_right_now', 'dashboard', 'normal' ); // At a Glance
}
add_action( 'admin_init', 'remove_dashboard_meta' );
@duongthanhthai
duongthanhthai / rarreg.key
Created September 21, 2022 09:30
1. Tạo 1 file tên rarreg.key, sau đó mở lên bằng một trình editor bất kỳ.
RAR registration data
Thaidt
Unlimited User License
UID=1f57b5f1294338f57825
64122122507825572ab1aeb1ba07ecac65f63b666162623d427353
a4648678adc0418186e960cd6fc354e9db7e268f39f9b9178a7a99
5ac679b4f4ed2fb58a77514c5606ea10e287886669caac7863ff5c
13489b7faf48aed1d0325598d890d29fc9601d6cb2efeb00d26d64
1aa91c1e9e39be717d800f912b83abf02d9c3fd614ea10e2878866
69caac787e3a9cd43d2df4894554e56de5573c340c10449d604464
@duongthanhthai
duongthanhthai / rarreg.key
Created September 21, 2022 09:31
Winrar KEY 2022
RAR registration data
Thaidt
Unlimited User License
UID=1f57b5f1294338f57825
64122122507825572ab1aeb1ba07ecac65f63b666162623d427353
a4648678adc0418186e960cd6fc354e9db7e268f39f9b9178a7a99
5ac679b4f4ed2fb58a77514c5606ea10e287886669caac7863ff5c
13489b7faf48aed1d0325598d890d29fc9601d6cb2efeb00d26d64
1aa91c1e9e39be717d800f912b83abf02d9c3fd614ea10e2878866
69caac787e3a9cd43d2df4894554e56de5573c340c10449d604464
How to add Ping Services list to WordPress?
Log in to your WordPress admin dashboard.
2. From Left sidebar click on Setting> Writing.
3. Copy the list I have provided below and overwrite ping list under the heading Update Service
4. Click on “Save Changes”.
`http://rpc.pingomatic.com
https://api.my.yahoo.com/rss/ping
https://bblog.com/ping.php
https://ping.rootblog.com/rpc.php
https://ping.weblogs.se/