SELECT
c.id AS id,
c.name AS name,
phone.phone AS phone,
email.email AS email
FROM (SELECT id, name, phone, email FROM contacts LIMIT 6) AS c
LEFT JOIN phone
ON c.phone = phone.phone_id
LEFT JOIN email
ON c.email = email.email_id
hostname -I
ip addr
$wslIP = wsl -- hostname -I
$wslIP = $wslIP.Split(" ")[0]
OpenWith "http://${wslIP}:5000/"
import { FC, memo } from "react";
interface IAppProps {
title: string;
}
interface IStatic<T> {
someStaticString: string;
someStaticObj: T;
}
const someObj = {
SOME_KEY: "SOME_VALUE"
};
const App: FC<IAppProps> & IStatic<typeof someObj> = memo((props) => {
const { title } = props;
return <>{title}</>;
});
App.someStaticString = "someStaticString";
App.someStaticObj = someObj;
export default App;
const averages = Array.from(
arr
.flatMap(v => v.properties.groups)
.reduce((acc, {id, 'well-being': value}) => {
const [count, total] = acc.get(id) ?? [0, 0];
acc.set(id, [count + 1, total + value]);
return acc;
}, new Map())
.entries(),
([id, [count, total]]) => ({id, average: total / count}),
);
console.log(averages);
macro_rules! low_high_wait {
(low) => {
led.set_low().unwrap();
};
(high) => {
led.set_high().unwrap();
};
(wait) => {
block!(timer.wait()).unwrap();
};
(low, $($rest:tt),+) => {
low_high_wait!(low);
low_high_wait!($($rest),+);
};
(high, $($rest:tt),+) => {
low_high_wait!(high);
low_high_wait!($($rest),+);
};
(wait, $($rest:tt),+) => {
low_high_wait!(wait);
low_high_wait!($($rest),+);
};
}
for _ in 0..24 {
low_high_wait!(wait, high, low, low, wait);
}
for _ in 0..24 {
low_high_wait!(wait, high, wait, low);
}
for _ in 0..24 {
low_high_wait!(wait, high, low, low, wait);
}
for _ in 0..24 {
low_high_wait!(wait, high, wait, low);
}
enum UserActionTypes { FETCH_USERS = "FETCH_USERS", FETCH_USERS_SUCCESS = "FETCH_USERS", FETCH_USERS_ERROR = "FETCH_USERS", }
enum UserActionTypes {
FETCH_USERS = 'FETCH_USERS',
FETCH_USERS_SUCCESS = 'FETCH_USERS_SUCCESS',
FETCH_USERS_ERROR = 'FETCH_USERS_ERROR',
}
ssh -p 2222 user@host
scp -P 2222 /local/file user@host:/remote/file
rsync -e 'ssh -p 2222'
ssh alias
interface Field {
value: any,
validation?: FieldValidation
}
interface InputField extends Field {
value: string,
placeholder: string,
textarea?: boolean,
maxChars?: number,
type?: 'text' | 'email' | 'password' | 'tel' | 'url',
dark?: boolean,
disabled?: boolean,
onInput?: () => any,
onKeyDown?: () => any,
onFocus?: () => any,
onBlur?: () => any
}
аналогично этому:interface Field {
value: any,
validation?: FieldValidation
}
type InputField = Field & {
value: string,
placeholder: string,
textarea?: boolean,
maxChars?: number,
type?: 'text' | 'email' | 'password' | 'tel' | 'url',
dark?: boolean,
disabled?: boolean,
onInput?: () => any,
onKeyDown?: () => any,
onFocus?: () => any,
onBlur?: () => any
}
interface BaseField {
value: any,
validation?: FieldValidation
}
interface InputField extends BaseField {
value: string,
placeholder: string,
textarea?: boolean,
maxChars?: number,
type?: 'text' | 'email' | 'password' | 'tel' | 'url',
dark?: boolean,
disabled?: boolean,
onInput?: () => any,
onKeyDown?: () => any,
onFocus?: () => any,
onBlur?: () => any
}
interface SelectField extends BaseField {
options: string[],
value: string,
placeholder: string,
dark?: boolean,
disabled?: boolean,
onSelect?: () => any,
onKeyDown?: () => any,
onFocus?: () => any,
onBlur?: () => any
}
type Field = InputField | SelectField;
const fields = ref<Record<string, Field>>({
name: {
value: '1',
placeholder: '123'
},
});
(async () => {
const result = await {
then(resolve) {
console.log('Привет сахар');
setTimeout(() => resolve(10), 3000);
}
};
console.log('Ух ты, данные из таймера:', result);
})();
(async () => {
try {
await {
then(_, reject) {
console.log('Привет сахар');
reject(new Error('Ошибочка'));
}
};
console.log('Это никогда не выполнится');
} catch (e) {
console.log('Ух ты, эксепшн:', e);
}
})();
console.log('Промисы никуда не делись?', (async () => {})() instanceof Promise)