Skip to content

Instantly share code, notes, and snippets.

View lazyload-datuan.js
if ('loading' in document.createElement('img')) {
document.querySelectorAll('[loading="lazy"]').forEach(elem => {
if (elem.dataset.src) {
elem.src = elem.dataset.src;
}
if (elem.dataset.srcset) {
elem.srcset = elem.dataset.srcset;
}
})
} else {
View warmupv3.sh
#!/bin/bash
DOMAIN=$1
scan_sitemap () {
[ -z "$1" ] && URL="https://$DOMAIN/sitemap.xml" || URL=$1
curl -L --compressed $URL 2>/dev/null | grep -Eo "http(s?):\/\/$DOMAIN[^ \"\'()\<>]+" | while read line; do
if [[ $line = *.xml ]]
then
echo "👉 Sitemap $line"
View Dockerfile-WordPressPDO
FROM php:5.6-apache
RUN a2enmod rewrite
# install the PHP extensions we need
RUN apt-get update && apt-get install -y libpng12-dev libjpeg-dev && rm -rf /var/lib/apt/lists/* \
&& docker-php-ext-configure gd --with-png-dir=/usr --with-jpeg-dir=/usr \
&& docker-php-ext-install gd
RUN docker-php-ext-install mysqli
RUN docker-php-ext-install pdo php_pdo
View xiaomi_to_youtube.sh
#!/bin/bash
# Your DDNS hostname or static IP
HOSTNAME="xxx.xxx.xxx.xxx"
# Username on source server
USER="root"
# Your camera MAC address
CAMERA_MAC="7811DCCCXXXX"
DATE=`/bin/date +%Y%m%d%H`
View functions.php
if ( is_category( array(1, 2, 3) ) ) {
// Do something
} else {
// Do something else
}
View warmup.sh
#!/bin/bash
#
# Written by AC - 2015 <al@terraltech.com> - sys0dm1n.com
#
URL=$1
wget --quiet http://$URL/sitemap.xml --no-cache --output-document - | egrep -o "http(s?)://$URL[^ \"\'()\<>]+" | while read line; do
if [[ $line == *.xml ]]
then
newURL=$line
@tdtgit
tdtgit / functions.php
Last active Apr 22, 2019
HTTP/2 Push CSS/JS with Autoptimize WordPress's plugin
View functions.php
<?php
add_filter('autoptimize_filter_cache_getname', 'pushAOFiles');
function pushAOFiles($in) {
$pushType = substr($in, strrpos($in, ".") + 1) === "js" ? "script" : "style";
// Do not push CSS files if it is already inline.
if ($pushType == "style" && ((bool)get_option("autoptimize_css_inline", true))) return;
View functions.php
/**
* Disable zxcvbn.min.js on WordPress loading
*/
function deregister_or_dequeue_scripts() {
wp_dequeue_script('wc-password-strength-meter');
}
add_action('wp_print_scripts', 'deregister_or_dequeue_scripts', 20);
View tagdiv_theme.js
function td_mobile_menu_toogle() {
jQuery('#td-top-mobile-toggle a, .td-mobile-close a').click(function(e) {
if (jQuery('body').hasClass('td-menu-mob-open-menu')) {
jQuery('body').removeClass('td-menu-mob-open-menu');
} else {
jQuery('body').addClass('td-menu-mob-open-menu');
}
e.preventDefault();
});
jQuery(document).find('#td-mobile-nav .menu-item-has-children').each(function(i) {
View facebook-giveaway.php
<?php
/* Developed by Juno_okyo */
/* Edited by tdtgit */
// EDIT HERE
define('ACCESS_TOKEN', 'YOUR_ACCESS_TOKEN');
// EDIT HERE
// ID thành viên sẽ bị bỏ qua khi quét