Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
#devops #wordpress #vuejs #docker

Nguyễn Minh Khôi khoipro

💭
#devops #wordpress #vuejs #docker
View GitHub Profile
@khoipro
khoipro / .htaccess
Created September 12, 2023 03:52
Server config rules for set X-Robot-Tags
View .htaccess
# For Apache, Litespeed
<Files ~ "\.(pdf|doc|docx|xls|xlsx|ppt|pptx)$">
Header set X-Robots-Tag "noindex, nofollow"
</Files>
@khoipro
khoipro / wp-php-coding-standards.php
Last active August 26, 2023 13:11
WP PHP Coding Standards
View wp-php-coding-standards.php
<?php
/**
* WP PHP Coding Standards
*
* @package CodingStandards
* @author codetot
**/
// To start a new PHP file, append phpDocs
/**
@khoipro
khoipro / wp-theme-standard.php
Last active August 26, 2023 04:50
Escape WordPress Sample PHP code
View wp-theme-standard.php
<?php
/** Sample escape output for WordPress theme
* @author codetot
* @package codeStandard
**/
?>
<?php // Simple escape html // ?>
<h2 class="product-card__title"><?php echo esc_html( $title ); ?></h2>
@khoipro
khoipro / functions.php
Created July 28, 2023 07:42
Fix Rankmath pro - product category schema
View functions.php
<?php
add_filter('rank_math/json_ld', 'codetot_product_rich_snippet_schema', 100);
/**
* Fix RankMath missing `AggregateRating` on product category schema
*
* @author codetot
*/
function codetot_product_rich_snippet_schema( $data ) {
@khoipro
khoipro / README.md
Created July 28, 2023 06:48
Câu hỏi phỏng vấn vị trí Frontend Developer tại Code Tốt
View README.md

Dưới đây là một số mẫu câu hỏi mà Code Tốt đặt ra với ứng viên. Chúng tôi hi vọng dù bạn biết đó là câu hỏi trong buổi phỏng vấn, thì việc đọc những nội dung này cũng sẽ giúp ích cho kiến thức bạn cần tìm hiểu và thực hành. Càng tìm hiểu và làm sát vấn đề chúng tôi nêu ra, bạn càng có cơ hội tiếp cận sâu hơn với mảng lập trình web.

Phần lớn ứng viên đạt tỷ lệ từ 75% trở lên sẽ được gia nhập đội ngũ của chúng tôi.

Nếu bạn đã sẵn sàng, hãy liên hệ với bộ phận Tuyển dụng của Code Tốt nhé.

Công cụ lập trình

@khoipro
khoipro / functions.php
Last active August 31, 2023 01:18
Fix Rank Math product schema (single product)
View functions.php
<?php
/**
* Fix missing review on product schema (Rank Math)
*
* @author codetot
**/
function codetot_update_missing_product_schema( $entity ) {
$stampedDBData = get_post_meta(get_queried_object_id(), 'stamped_io_product_reviews_new', true);
@khoipro
khoipro / .lando-example.yml
Created February 4, 2023 03:29
Best practice with .lando config
View .lando-example.yml
# With php XDEBUG on or off
tooling:
xdebug-on: # run: lando xdebug-on
service: appserver
description: Enable xdebug for apache.
cmd: "docker-php-ext-enable xdebug && /etc/init.d/apache2 reload"
user: root
xdebug-off: # run: lando xdebug-off
service: appserver
description: Disable xdebug for apache.
@khoipro
khoipro / laravel-faq-beginners.md
Created December 27, 2022 23:44
Laravel FAQ for beginners (with Windows)
View laravel-faq-beginners.md
@khoipro
khoipro / .lando.yml
Created December 2, 2022 03:33
Example lando config for WordPress recipes (with redis, phpmyadmin, mailhog, nginx with domain .test)
View .lando.yml
name: codetot-vn
recipe: wordpress
proxy:
appserver_nginx:
- codetot.test
config:
webroot: .
database: mariadb
via: nginx
php: '7.4'
@khoipro
khoipro / slider.js
Last active July 28, 2023 03:17
Load swiper slides lazyload (with <noscript> tag) for each slide
View slider.js
import { select, selectAll, hasClass, removeClass, loadNoscriptContent } from 'lib/dom'
import Swiper, { Navigation } from 'swiper'
export default el => {
const sliderEl = select('.js-slider', el)
const slideEls = selectAll('.swiper-slide', el)
if (sliderEl) {
const swiper = new Swiper(sliderEl, {
freeMode: true,