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
// Получаю данные из firebase | |
componentDidMount() { | |
database.ref(this.urlRequest).once('value').then(res=>{ | |
this.setState({ | |
wordArr: res.val() || [], | |
}) | |
}) | |
} | |
// Другой метод получения данных. Он будет следить за изменениями данных. |
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
// Просто fetch, который асинхронно что-то сделал | |
handleOnSearch = () => { | |
const text = 'time'; | |
const lang = 'en-ru'; | |
fetch( | |
`https://reactmarathon-api.netlify.app/api/translate?text=${text}&lang=${lang}`, | |
{ | |
headers: { | |
'Authorization': 'dict.1.1.20200629T110424Z.820c51d0c3c6ce08.edfcf3c77862c014dce8158ae4581d8a842e9b30' |
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
const wordsList = [ | |
{ | |
eng: 'between', | |
rus: 'между', | |
id: 1 | |
}, | |
{ | |
eng: 'high', | |
rus: 'высокий', | |
id: 2 |
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 | |
// Решаю проблему отстутствия редиректа и непраивльного canonical от Yoast SEO в случае изменения части URL для произвольного типа записи. | |
// Если произвольный тип записи зарегистрирован следующим обарзом | |
register_taxonomy( 'tournaments', [ 'fight' ], [ | |
'label' => '', | |
'labels' => [ | |
'name' => 'Турниры', | |
'singular_name' => 'Турнир', | |
'search_items' => 'Поиск', |
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 | |
//Разбирает URL и возвращает его компоненты (в данном случае вернется доменное имя) | |
parse_url($comment->comment_author_url, PHP_URL_HOST) | |
// Удаляет теги (может вторым параметром получить тег, который не надо удалять). В примере разрешено оставить тег br. | |
strip_tags($input, '<br>'); | |
// Редирект на php в любой момент ;) | |
echo "<script>window.location = '$next_iteration_url'</script>"; |
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
// Плавный разворот свернутого контента WordPress. Контент обрезается кнопкой «Читать далее». Клик по кнопке плавно разворачивает обрезанный контет. | |
// JavaScript | |
window.addEventListener('load', function () { | |
const read_more_btns = document.querySelectorAll('.reviews-ac__read-more_js'); | |
if (read_more_btns.length) { | |
read_more_btns.forEach((item) => { | |
item.addEventListener('click', (e) => { | |
man_account_review_read_more_review_click(e); | |
}) |
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 | |
<div class="trading-page__pricing-table-wrap table-wrap"> | |
<div class="table-wrap__inner"> | |
<table> | |
... | |
</table> | |
</div> | |
</div> |
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
// Таймер будет вставлен в начало node wrapper_timer. | |
// Через 1 минуту в коносоль выведется test123. Таймер на 1 минуту будет отображен в начале node footer | |
const footer = document.querySelector('.footer'); | |
man_get_timer('test_timer', footer, 1, function(){ | |
console.log('test123'); | |
}); | |
// Таймер будет вставлен в начало wrapper_timer. | |
function man_get_timer(timer_id, wrapper_timer, min_timer_pause, after_stop_timer_function) { |
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
Перенос на следующую строку | |
flex-wrap: wrap; | |
justify-content — управляет выравниванием элементов по главной оси. | |
По умолчанию выстраивает элементы в начале блока. justify-content: flex-start | |
justify-content: flex-start; | |
justify-content: flex-end; | |
justify-content: center; | |
justify-content: space-between; | |
justify-content: space-around; |