Skip to content

Instantly share code, notes, and snippets.

View h1ldebrand's full-sized avatar
🌴
On vacation

Vadim Semenchuk h1ldebrand

🌴
On vacation
View GitHub Profile
@h1ldebrand
h1ldebrand / fadeIn
Last active October 16, 2017 12:50
My own function fadeIn on Vanilla.js
function fadeIn(selector, time){
let timer = time || 400;
let element = document.querySelectorAll(selector)[0];
let timeForSetInterver = 20;
let opacityEnd = 1;
let count = timer / timeForSetInterver;
let step = opacityEnd / count;
let i = 0;
@h1ldebrand
h1ldebrand / fadeOut
Created October 16, 2017 12:53
my own function fadeOut on Vanilla.js
function fadeOut(selector, time){
let timer = time || 400;
let element = document.querySelectorAll(selector)[0];
let timeForSetInterver = 20;
let opacityStart = getComputedStyle(element).opacity;
let count = timer / timeForSetInterver;
let step = opacityStart / count;
let i = 0;
//php file check
if ($_SERVER['REMOTE_ADDR'] == '194.29.63.96' ) {
//your code here
}
//smarty check
{if $smarty.server.REMOTE_ADDR == '194.29.63.96'}
{* other debugging code goes here *}
{/if}
@h1ldebrand
h1ldebrand / Git command
Last active June 21, 2018 13:06
Git command
git config user.name
git config user.email - Имя и email
git config alias.mycomm - алиасы для команд
git config --global core.editor - изменить редактор для редактирования файлов git
git check-ignore -v dir/file.txt - проверить игнорируется файлы по данному пути
git reset HEAD file.txt - отмена индексации файла
git add --force file.txt
git add -f file.txt - добавить в индекс файл который находится в .gitignore
git rm file.txt - удалить файл с проекта и добавить в индекс
git rm -r dir - удалить папку с проекта и добавить в индекс
@h1ldebrand
h1ldebrand / Редактирование файлов в Vim
Last active June 21, 2018 11:00
Редактирование файлов в Vim
1. Откроем Vim.
2. Наберем :edit hello.txt и нажмем enter.
3. Нажмем i.
4. Введем текст Hello World.
5. Нажмем клавишу <Esc>.
@h1ldebrand
h1ldebrand / получить значение поля в блоке и передать его в js
Created June 24, 2018 12:12
получить значение поля в блоке и передать его в js
function naturetour_page_attachments_alter(array &$attachments){
$uuid = \Drupal\block\Entity\Block::load('usefull')->getPlugin()->getDerivativeId();
$block_content = \Drupal::service('entity.repository')->loadEntityByUuid('block_content', $uuid);
if ($block_content) {
$field_value = $block_content->field_something_item->value;
$attachments['#attached']['drupalSettings']['naturetour']['custom']['something_item'] = $field_value;
}
}
@h1ldebrand
h1ldebrand / Modules for drupal
Last active January 2, 2019 11:15
Modules for drupal
composer require drupal/admin_toolbar drupal/token drupal/pathauto drupal/twig_field_value drupal/twig_tweak drupal/paragraphs drupal/shield drupal/field_group drupal/metatag drupal/xmlsitemap drupal/current_page_crumb drupal/svg_image
<svg class="pl-arrow-bottom">
<use xlink:href="#icon-arrow-bottom"></use>
</svg>
@h1ldebrand
h1ldebrand / docker command
Created July 7, 2019 10:39
docker command
docker run -it ubuntu bash создать сеанс интерактивной работы на подключаемом устройстве
docker run --name ubuntuName -it ubuntu bash запуск контернера + указываем ему имя
docker ps -a выводит список всех контейнеров включая остановленные
docker ps выводит список всех работающих контейнеров
docker start 'name' перезапустить контейнер name
docker stop 'name' остановить контейнер name
docker inspect 'name' информация о контейнере 'name'
docker logs ubuntuName список всех событий внутри контейнера ubuntuName
docker rm ubuntuName удалить контейнер ubuntuName
@h1ldebrand
h1ldebrand / change permission via git
Created July 10, 2019 13:01
change permission via git
git config core.fileMode false