find . -name "node_modules" -type d -prune -print | xargs du -chs
FOR /d /r . %d in (node_modules) DO @IF EXIST "%d" echo %d"
find . -name 'node_modules' -type d -prune -print -exec rm -rf '{}' \;
// создать массив из N элементов, и заполнить его числами от 1 до N: | |
[...Array(N+1).keys()].slice(1) | |
// деструктуризация и присваивание в уже существующие переменные: | |
let isOnline = true; | |
let isLoggedIn = false; | |
const data = { isOnline: false, isLoggedIn: true }; | |
({ isOnline, isLoggedIn } = data); |
# How to rebase automatically on git pull | |
https://dev.to/mliakos/don-t-git-pull-use-git-pull-rebase-instead-5b8k | |
# How to remove untraceable files | |
git clean -df |
<?php | |
/*************** | |
* set attr defer for js-scripts | |
***************/ | |
add_filter( 'script_loader_tag', 'add_defer_attribute', 10, 2 ); | |
function add_defer_attribute( $tag, $handle ) { | |
$scripts_to_defer = array( 'google-map', 'google-map-init' ); | |
foreach ( $scripts_to_defer as $defer_script ) { |
class Configuration { | |
private static $instance; | |
private function __construct() {/* */} | |
public static function getInstance() { | |
if (self::$instance === null) { | |
self::$instance = new Configuration(); | |
} | |
return self::$instance; | |
} | |
public function get($key) {/* */} |
`npx npm-check -u` - checks all available updates, shows safe and unsafe updates, and give ability to make updates | |
OR | |
https://stackoverflow.com/questions/16525430/npm-check-and-update-package-if-needed |
function myFunc() { | |
console.log(this); | |
return function () { | |
console.log(this); | |
} | |
} | |
var user = { | |
name: 'Vasya' | |
}; |
npx prettier --check '{worker-exercise,worker-solution}/**/!({.gitignore,package.json})*.*' | |
npx prettier --check 'src/**/!(*{.svg,.pdf,.png})*.*' // for MMS 2.0 | |
npx eslint --fix '{worker-exercise,worker-solution}/**/*.{js,jsx,ts,tsx}' --ignore-pattern node_modules | |
// negating pattern '!(*test).js' will match all JS files, except those ending in test.js, so foo.js but not foo.test.js |
find . -name "node_modules" -type d -prune -print | xargs du -chs
FOR /d /r . %d in (node_modules) DO @IF EXIST "%d" echo %d"
find . -name 'node_modules' -type d -prune -print -exec rm -rf '{}' \;
name: Ruby | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
jobs: | |
build: |
/* for vanilla js */ | |
async function getComponent() { | |
const element = document.createElement('div'); | |
const { default: _ } = await import(/* webpackChunkName: "lodash" */ 'lodash'); | |
element.innerHTML = _.join(['Hello', 'webpack'], ' '); | |
return element; | |
} |