-
Основные типы и структуры данных
- number, string, boolean, undefined
- object, array, null
- symbol, bigint, ...
-
типы переменных
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import type { FC, HTMLAttributes } from "react"; | |
type BoxProps = { | |
as?: keyof JSX.IntrinsicElements; | |
} & HTMLAttributes<HTMLOrSVGElement>; | |
export const Box: FC<BoxProps> = ({ as: Component = "div", ...props }) => { | |
return <Component {...props} />; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import type { LegacyRef, MutableRefObject, RefCallback } from 'react' | |
/** | |
* @example <div ref={mergeRefs(ref, innerRef)} /> | |
*/ | |
export default function mergeRefs<T = any>( | |
refs: Array<MutableRefObject<T> | LegacyRef<T>>, | |
): RefCallback<T> { | |
return value => { | |
refs.forEach(ref => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.emulated-flex-gap { | |
--gap: 12px; | |
display: inline-flex; | |
flex-wrap: wrap; | |
margin: calc(-1 * var(--gap)) 0 0 calc(-1 * var(--gap)); | |
width: calc(100% + var(--gap)); | |
} | |
.emulated-flex-gap > * { | |
margin: var(--gap) 0 0 var(--gap); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
html { | |
width: 100vw; | |
overflow-x: hidden; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* https://css-tricks.com/full-width-containers-limited-width-parents/ */ | |
.full-width { | |
width: 100vw; | |
position: relative; | |
left: 50%; | |
right: 50%; | |
margin-left: -50vw; | |
margin-right: -50vw; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
register_meta( | |
'user', | |
'user_friends_list', | |
[ | |
'object_subtype' => 'user', | |
'type' => 'array', | |
'description' => 'Friends Ids', | |
'single' => true, | |
'sanitize_callback' => null, | |
'auth_callback' => 'null', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Your\Namespace; | |
use WP_REST_Server; | |
class Todos extends \WP_REST_Controller | |
{ | |
public function __construct() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<IfModule mod_rewrite.c> | |
RewriteRule ^(api)($|/) - [L] | |
RewriteEngine On | |
RewriteBase / | |
RewriteRule ^index\.html$ - [L] | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteCond %{REQUEST_FILENAME} !-l | |
RewriteRule . /index.html [L] | |
</IfModule> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function handleSubmit(event) { | |
event.preventDefault(); | |
const formData = new FormData(event.target); | |
const data = [...formData.entries()]; | |
const asString = data | |
.map(x => `${encodeURIComponent(x[0])}=${encodeURIComponent(x[1])}`) | |
.join('&'); | |
console.log(asString); | |
} |