JavaScript has Template Literals (or Template Strings) built-in. This results in a string, after evaluating replacement expressions.
const name = 'Tim'
const job = 'Eng'
[2023-01-01 23:25:00] DELETE /logout 453 | |
[2023-01-11 20:56:00] GET /settings 121 | |
[2023-01-08 18:51:00] POST /dashboard/85 11 | |
[2023-01-12 11:00:00] DELETE /settings 68 | |
[2023-01-12 11:00:00] WARNING Memory usage is high. | |
[2023-01-12 11:00:00] DETAILS Current usage: 85%, Threshold: 80% | |
[2023-01-11 20:06:00] GET /profile 278 | |
[2023-01-04 17:19:00] GET /dashboard/12/overview 65 | |
[2023-01-04 00:16:00] GET /home 477 | |
[2023-01-01 04:18:00] POST /settings 434 |
import { useEffect, useState } from 'react' | |
/* | |
takes in a string and returns a hash int code | |
which can be useful for generating react keys | |
base on input strings, that may or may not change | |
const [hashCode, setHashCodeString] = useHashCode() | |
*/ |
/* | |
This hook will trap tabbing within a component. | |
A common usecase is a Modal, in which you want tabbing to keep focus within the modal. | |
This assumes that any custom `tabindex` prop is either `0` (should be tabbable, no order preference) | |
or `-1` (not tabbable, should skip). Anything like `tabIndex={2}` will not get ordered correctly. | |
It will skip over disabled inputs. | |
--- |
{ | |
"editor.tabSize": 2, | |
"window.zoomLevel": 0, | |
"editor.snippetSuggestions": "none", | |
"editor.parameterHints.enabled": false, | |
"editor.suggest.snippetsPreventQuickSuggestions": false, | |
"html.suggest.html5": false, | |
"editor.hover.enabled": false, | |
"editor.codeActionsOnSave": null, | |
"javascript.autoClosingTags": false, |
syntax on | |
colorscheme desert | |
set encoding=utf8 | |
filetype plugin on | |
filetype indent on | |
" Avoid garbled characters in Chinese language windows OS | |
let $LANG='en' | |
set langmenu=en |
{ | |
"editor.tabSize": 2, | |
"window.zoomLevel": 0, | |
"editor.snippetSuggestions": "none", | |
"editor.parameterHints.enabled": false, | |
"editor.suggest.snippetsPreventQuickSuggestions": false, | |
"html.suggest.html5": false, | |
"editor.hover.enabled": false, | |
} |
INCOGNITO=false | |
LOW_BANDWIDTH=true | |
PLAY_SOUND="/your/mp3.mp3" | |
SHOW_ONLY_SERIES="sonyps5c,sonyps5de,xboxss,xboxsx" | |
STORES="target,walmart,xbox,amazon,antonline,bestbuy,playstation" |
/* | |
* (c) 2012 inflammable/raromachine | |
* Licensed under the MIT License. | |
* --- | |
* this is a refactored version of https://gist.github.com/inflammable/2929362 | |
*/ | |
const alphabet = '123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ' | |
const base = alphabet.length |
/* | |
see https://developer.mozilla.org/en-US/docs/Web/API/Navigator/sendBeacon | |
```jsx | |
const MyComponent = ({ children }) => { | |
// will get fired if the page unloads while the component is mounted | |
useUnloadBeacon({ | |
url: 'https://api.my.site/route', | |
payload: () => { | |
return 'something' |