This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// before | |
renderPageLinks = () => { | |
const {page, pages} = this.props | |
let array_pages = Array.from({length: pages}, (v, k) => 1+k) | |
if(pages < page) { | |
this.props.onChangePage(pages) | |
} | |
return array_pages.map((item) => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# place this func into the .bashrc, .bash_profile, .... | |
function kill-on-port { kill -9 $(lsof -i tcp:"$1" -t); } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var path = require('path'); | |
var fs = require('fs'); | |
function mkdirP(p, mode) { | |
if (p.charAt(0) != '/') { return } | |
var ps = path.normalize(p).split('/'); | |
if(!fs.existsSync(p)) { | |
mkdirP(ps.slice(0,-1).join('/'), mode); | |
fs.mkdirSync(p, mode); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
( | |
export PKG=eslint-config-react-app; | |
npm info "$PKG@latest" peerDependencies --json | command sed 's/[\{\},]//g ; s/: /@/g' | xargs sudo npm -g install --save-dev "$PKG@latest" | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Selective_Walker extends Walker_Nav_Menu | |
{ | |
function walk( $elements, $max_depth) { | |
$args = array_slice(func_get_args(), 2); | |
$output = ''; | |
if ($max_depth < -1) //invalid parameter | |
return $output; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
In case if we need to define custom post types manually | |
*/ | |
/* | |
Define constants at first for avoid hidden errors while working with custom post types | |
*/ | |
if ( !defined( 'POST_TYPE_PRODUCT' ) ) define( 'POST_TYPE_PRODUCT', 'product'); | |
if ( !defined( 'POST_TYPE_ORDER' ) ) define( 'POST_TYPE_ORDER', 'product_order'); | |
if ( !defined( 'TAXONOMY_CATEGORY' ) ) define( 'TAXONOMY_CATEGORY', 'product_cat'); |