Standard escape codes are prefixed with Escape
:
- Ctrl-Key:
^[
- Octal:
\033
- Unicode:
\u001b
- Hexadecimal:
\x1B
- Decimal:
27
import { useIsInStrictMode } from './useIsInStrictMode'; | |
test('detect strict mode', async () => { | |
function TestComponent() { | |
const [isInStrictMode, CheckStrictMode] = useIsInStrictMode(); | |
return ( | |
<p> | |
<CheckStrictMode /> | |
{`Strict mode: ${isInStrictMode ? 'on' : 'off'}`} |
/** | |
* Helper to test how alpha-transparent colors are layered in the browser. | |
* | |
* @example | |
* blendColors('255 0 0 / 20%', '60 60 40 / 30%', '128 96 44 / 60%') | |
* // -> {r: 128, g: 84, b: 40, a: 0.7764705882352941} | |
*/ | |
function overlayColors(...colors) { | |
let canvas; | |
if (typeof OffscreenCanvas === 'function') { |
import * as React from "react"; | |
// see: https://stackoverflow.com/questions/55045566/react-hooks-usecallback-causes-child-to-re-render/55047178 | |
/** | |
* Useful when you when to pass a function that depends on a piece of state, | |
* as a prop, without triggering a re-render everytime. | |
* | |
* @example | |
* |
function checkAdblockerEnabled() { | |
const div = document.createElement('div'); | |
div.className = 'ad_container'; | |
const style = document.createElement('style'); | |
style.innerText = `.ad_container { width:500px; }`; | |
document.head.appendChild(style); | |
document.body.appendChild(div); | |
const hasAdblock = div.offsetWidth < 500; | |
document.head.removeChild(style); | |
document.body.removeChild(div); |
convert -density 256x256 -background transparent favicon.svg -define icon:auto-resize -colors 256 favicon.ico |
Samsung's otherwise excellent 2016 range of UHD TVs received an update that added advertisements to the UI. This has been complained about at great length on Samsung's forums and repeatedly, Samsung have refused to add an option to remove them.
The ads interrupt the clean UI of the TV and are invasive. Here's an example of how they look:
This guide was originally posted on Samsung's TV forums but unfortunately, that site is a super-slow and barely accessible unusable mess.
export function unindent(template: TemplateStringsArray, ...args: any[]): string { | |
let numSpaces = 999; | |
for (const part of template) { | |
for (const indentation of part.match(/\n +/g) || []) { | |
numSpaces = Math.min(numSpaces, indentation.length - 1); | |
} | |
} | |
const spaces = new RegExp('\n' + ' '.repeat(numSpaces < 999 ? numSpaces : 0), 'g'); | |
return template |
.cursor { | |
cursor: url("cursor.png") 0 0, pointer; /* Legacy */ | |
cursor: url("cursor.svg") 0 0, pointer; /* FF */ | |
cursor: -webkit-image-set(url("cursor.png") 1x, url("cursor@2x.png") 2x) 0 0, pointer; /* Webkit */ | |
} |