(лево ИЛИ право) ИЛИ (верх ИЛИ низ)
// Левое ИЛИ правое значение.
type OffsetHorizontal =
| { left: number; right?: never; }
| { right: number; left?: never; }
// Верхнее ИЛИ нижнее значение.
type OffsetVertical =
| { top: number; bottom?: never; }
| { bottom: number; top?: never; }
// Горизонтальные значения, с запретом использования с вертикальными.
type OffsetHorizontalOnly = OffsetHorizontal & {
top?: never;
bottom?: never;
}
// Вертикальные значения, с запретом использования с горизонтальными.
type OffsetVerticalOnly = OffsetVertical & {
left?: never;
right?: never;
}
// OffsetHorizontalOnly ИЛИ OffsetVerticalOnly.
type Offset = OffsetHorizontalOnly | OffsetVerticalOnly;
// Верно:
// { left: 100 }
// { right: 100 }
// { top: 100 }
// { bottom: 100 }
// Неверно:
// { left: 100, right: 100 }
// { top: 100, bottom: 100 }
// { left: 100, top: 100 }
// { right: 100, top: 100 }
// { left: 100, bottom: 100 }
// { right: 100, bottom: 100 }
// Левое ИЛИ правое значение.
type OffsetHorizontal =
| { left: number; right?: never; }
| { right: number; left?: never; }
// Верхнее ИЛИ нижнее значение.
type OffsetVertical =
| { top: number; bottom?: never; }
| { bottom: number; top?: never; }
// OffsetHorizontal И/ИЛИ OffsetHorizontal.
type Offset =
| OffsetHorizontal
| OffsetVertical
| (OffsetHorizontal & OffsetVertical);
// Верно:
// { left: 100 }
// { right: 100 }
// { top: 100 }
// { bottom: 100 }
// { left: 100, top: 100 }
// { right: 100, top: 100 }
// { left: 100, bottom: 100 }
// { right: 100, bottom: 100 }
// Неверно:
// { left: 100, right: 100 }
// { top: 100, bottom: 100 }
Applications should read a PDF File from its end.
Applications should read a PDF File from its end.
PDF.js is fetching the entire PDF file from a server. Can it fetch only the required portions for rendering?
Actually, PDF.js is doing just that. PDF is a complicated format; in most of the cases, the vital data of a PDF document is located at the end. Depending on browser support and on what web server returns the HTTP Range Requests headers, PDF.js may automatically start using HTTP Range Requests to fetch not-yet-loaded portions of a PDF needed for rendering visible pages, so a document can be rendered without fully loading it.
function* arithmeticSequence(a1, d, length = Infinity) {
for (let i = 0; i < length; i++) {
yield a1 + i * d;
}
}
const t = arithmeticSequence(10, 10);
t.next().value // 10
t.next().value // 20
t.next().value // 30
// ну и т.д., вызываем столько раз, сколько значений нужно получить
for (const n of arithmeticSequence(1, 23)) {
if (n > 100) {
break;
}
console.log(n); // будет выведено: 1 24 47 70 93
}
[...arithmeticSequence(3, 4, 5)] // получим следующий массив: [3, 7, 11, 15, 19]
[...arithmeticSequence(1, 1)] // шутка, так не надо
x_r = (sqrt(x^2+y^2)-r0)/(r1-r0)*Width
y_r = (atan(y/x)/pi+1/2)*Height
.your-image {
pointer-events: none;
}
.your-image {
user-select: none;
}
body {
user-select: none;
}
body {
-webkit-tap-highlight-color: transparent;
}
type Schemas<P extends keyof paths> = paths[P]['post'] extends {requestBody: infer R} ? R : never;
1111111
До этого покупал домен на GoDaddy , но сейчас они вроде как собраются (или собрались) блокиовать домены
Everything was working well (Mainly use this domain for my personal emails) and now nothing is working no warnings, nothing.
Hello, Your account violated our terms of service specifically fraud. The suspension is permanent and we will not be making changes on our end.
В РФ тоже опасаюсь
type JoinKeys<T extends object> = JoinKeysDeep<T> extends infer J extends Record<
string,
unknown
>
? { [Key in J extends J ? keyof J : never]: J extends J ? J[Key] : never }
: never;
type JoinKeysDeep<
T extends object,
K extends keyof T = JoinKeysDeep.GetKeys<T> & keyof T,
> = K extends K & (string | number)
? T[K] extends object
? JoinKeysDeep<T[K]> extends infer J extends Record<string, unknown>
? J extends J
? Record<`${K | '*'}.${keyof J & (string | number)}`, J[keyof J]>
: never
: never
: Record<K | '*', T[K]>
: never;
namespace JoinKeysDeep {
export type GetKeys<T> = T extends unknown[]
? keyof T &
(number extends T['length']
? // array
number
: // tuple
`${number}`)
: keyof T;
}
const blocks = ref(Array.from({ length: 5 }, (_, i) => (-~i) ** 2));
const active = ref(0);
function next() {
active.value = (active.value + 1 + blocks.value.length) % blocks.value.length;
}
let intervalId = null;
onMounted(() => intervalId = setInterval(next, 500));
onUnmounted(() => clearInterval(intervalId));
<div
v-for="(n, i) in blocks"
v-text="n"
:class="[ 'box-item', { active: i === active } ]"
></div>
:nth-child
- не круто. Лучше сделать компонент, принимающий массив цветов и создающий блоки на его основе. Соответственно, вместо класса будет назначаться цвет фона напрямую, как-то так:<div
v-for="(n, i) in colors"
:style="{ backgroundColor: i === active ? n : '' }"
...