Skip to content

Instantly share code, notes, and snippets.

@nhoxzunbmt
nhoxzunbmt / react-rendering.md
Created March 24, 2021 07:37 — forked from tuhuynh27/react-rendering.md
A (Mostly) Complete Guide to React Rendering Behavior

Translated from https://blog.isquaredsoftware.com/2020/05/blogged-answers-a-mostly-complete-guide-to-react-rendering-behavior/, author: Mark Erikson (from Redux team)

A (Mostly) Complete Guide to React Rendering Behavior

Bài viết cung cấp chi tiết về cách mà React render hoạt động, và việc sử dụng Context và Redux ảnh hưởng thế nào tới quá trình render của React.

"Render" là gì

Rendering is the process of React asking your components to describe what they want their section of the UI to look like, now, based on the current combination of props and state.

@nhoxzunbmt
nhoxzunbmt / Httpd.conf
Created November 18, 2019 15:58 — forked from barryvdh/Httpd.conf
Httpd.conf Customization for Apache (DirectAdmin Custom HTTPD Configurations)
# Rewrite the WS requests
RewriteCond %{REQUEST_URI} ^/socket.io [NC]
RewriteCond %{QUERY_STRING} transport=websocket [NC]
RewriteRule /(.*) ws://localhost:6001/$1 [P,L]
# Rewrite the HTTP requests
ProxyPass /socket.io http://localhost:6001/socket.io
ProxyPassReverse /socket.io http://localhost:6001/socket.io
# For API requests
UPDATE `products` SET `rating` = ROUND( 1 + RAND( ) *5 ,1);
@nhoxzunbmt
nhoxzunbmt / xpub-xsub.js
Created February 15, 2019 08:16 — forked from tjanczuk/xpub-xsub.js
How to connect 5 publishers with 5 subscribers over TCP using ZeroMQ's XPUB/XSUB proxy
// How to connect 5 publishers with 5 subscribers
// over TCP using ZeroMQ's XPUB/XSUB proxy.
// sub (connect)
// <-8701->
// (bind) xpub <---> xsub (bind)
// <-8700->
// (connect) pub
var zmq = require('zmq');
@nhoxzunbmt
nhoxzunbmt / resize.js
Created July 20, 2018 07:13 — forked from xelaz/resize.js
NodeJs resize and optimize images with sharp
const fs = require('fs');
const glob = require('glob');
const sharp = require('sharp');
const Promise = require('bluebird');
const successList = [];
const errorList = {};
glob("wp-content/uploads/**/*.+(jpeg|jpg)", function (er, files) {
Promise.resolve(files)
function remove_jquery_migrate( $scripts ) {
if ( ! is_admin() && isset( $scripts->registered['jquery'] ) ) {
$script = $scripts->registered['jquery'];
if ( $script->deps ) {
$script->deps = array_diff( $script->deps, array( 'jquery-migrate' ) );
}
}
}
add_action( 'wp_default_scripts', 'remove_jquery_migrate' );
<title>Welcome file</title>

Welcome to StackEdit!

Hi! I'm your first Markdown file in StackEdit. If you want to learn about StackEdit, you can read me. If you want to play with Markdown, you can edit me. If you have finished with me, you can just create new files by opening the file explorer on the left corner of the navigation bar.

Files

StackEdit stores your files in your browser, which means all your files are automatically saved locally and are accessible offline!

Create files and folders

@nhoxzunbmt
nhoxzunbmt / wp-query-ref.php
Created March 22, 2018 11:09 — forked from luetkemj/wp-query-ref.php
WP: Query $args
// This gist is now maintained on github at https://github.com/luetkemj/wp-query-ref
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.github.io
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query#Parameters
* Source: https://core.trac.wordpress.org/browser/tags/4.9.4/src/wp-includes/query.php
*/