sudo apt install zsh-autosuggestions zsh-syntax-highlighting zsh
| import { useEffect } from 'react'; | |
| import { KeyboardKey } from 'enums/keyboardKey'; | |
| export const useKeyPress = (callback: (T?: any) => void, keys: KeyboardKey[]) => { | |
| const onKeyDown = (event: KeyboardEvent) => { | |
| const wasAnyKeyPressed = keys.some((key) => event.key === key); | |
| if (wasAnyKeyPressed) { | |
| event.preventDefault(); | |
| callback(); |
firewall-cmd --permanent --add-service=http.firewall-cmd --reload.| function isValid(str) { | |
| var regex = new RegExp("^[0-9]{3}-?[0-9]{7}-?[0-9]{1}$"); | |
| if (!regex.test(str)) { | |
| return false; | |
| } | |
| str = str.replace(/-/g, ''); |
| function createElement(tagName, id = null, __class = null, src = null,customAtribute = null) { | |
| let element = document.createElement(tagName); | |
| element.setAttribute('id', (id == null) ? '' : id); | |
| if (Array.isArray(__class)) { | |
| __class.forEach(item => { | |
| element.classList.add(item); | |
| }); | |
| } else { | |
| element.classList.add((__class == null) ? 'none' : __class); |
| const users = [ | |
| { 'user': 'joey', 'age': 32 }, | |
| { 'user': 'ross', 'age': 41 }, | |
| { 'user': 'chandler', 'age': 39 } | |
| ] | |
| // Native | |
| users.find(function (o) { return o.age < 40; }) | |
| //lodash |
| $obj_merged = (object) array_merge((array) $obj1, (array) $obj2); |
| import store from './store'; | |
| import { getState } from './storage'; | |
| export default function () { | |
| if (store.initialized) { | |
| return Promise.resolve(); | |
| } | |
| return getState() | |
| .then(state => store.commit('loadFromCache', state)); |