const handler = handlePasteImage.bind(null, whatever);
addEventListener('paste', handler, { capture: true, });
const handler = {
whatever: whatever,
handleEvent(event) {
handlePasteImage(event, this.whatever);
},
};
addEventListener('paste', handler, { capture: true, });
В 2016-м году, делали нечто, что потом начали люди называть SPA - но за счёт аяксов, которые грузят что нужно. При этом сохраняется структура страниц на сервере, и нет и не было проблем с индексацией.
Вот от фронтовых фреймворков верстки - профит заметен был (тот же фаундейшн, бутстрап и тд) - действительно ускоряло и упрощало жизнь.
1. Стильно, модно, молодёжно. Других не могу придумать. Вроде бы как должно работать быстрее, но практика этого не показывает (или настолько незначительно, что конечному пользователю - пофиг, будет работать аякс или вьюшная реактивность).
Собственно, а зачем это всё нужно, если профит, кажется - нулевой
def sort_pair(a, b):
def sort_pair(pair):
a, b = pair
if a <= b:
return (a, b)
else:
return (b, a)
print(sort_pair((5, 1))) # (1, 5)
print(sort_pair((2, 2))) # (2, 2)
print(sort_pair((7, 8))) # (7, 8)
from typing import Tuple
def sort_pair(pair: Tuple[int, int]) -> Tuple[int, int]:
a, b = pair
if a <= b:
return (a, b)
else:
return (b, a)
print(sort_pair((5, 1))) # (1, 5)
print(sort_pair((2, 2))) # (2, 2)
print(sort_pair((7, 8))) # (7, 8)
<button class="dangerous" disabled>Сохранить</button>
document.addEventListener(‘load’, function() {
const dangers = document.querySelectorAll(".dangerous");
dangers.forEach((item) => {
item.removeAttribute('disabled'):
});
}
*.css linguist-detectable=false
struct Api {
key: String
}
struct ApiPart<'a>{
api: &'a Api
}
impl Api {
pub fn part<'a>(&'a self) -> ApiPart<'a> {
ApiPart {api: self}
}
}
fn new(api_key: *const String) -> Self {
let api_key = unsafe { &*api_key };
return Self {
api_key,
};
}
fn new(api_key: impl Into<String>) -> Self {
let api_key = api_key.into();
return Self {
api_key,
};
}