This file contains hidden or 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
/* Yandex Map | |
========================================================*/ | |
var map_container = document.getElementById("map"); | |
if (map_container) { | |
$(document).ready(function () { | |
get_map(map_container, map_contact); | |
}); | |
} | |
function get_map(map_container, map_array){ |
This file contains hidden or 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
var timer, // быстрая прокрутка, отключение ховера при прокрутке | |
classname = 'disable-hover', | |
$body = $('body'); | |
$(window).scroll(function() { | |
clearTimeout(timer); | |
if (!$body.hasClass(classname)) { | |
$body.addClass(classname); | |
} | |
timer = setTimeout(function(){ |
This file contains hidden or 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
var timer, // быстрая прокрутка, отключение ховера при прокрутке | |
classname = 'disable-hover', | |
$body = $('body'); | |
$(window).scroll(function() { | |
clearTimeout(timer); | |
if (!$body.hasClass(classname)) { | |
$body.addClass(classname); | |
} | |
timer = setTimeout(function(){ |
This file contains hidden or 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 | |
/** | |
* Отправка уведомлений при публикации поста | |
*/ | |
function roomble_send_notification( $new_status, $old_status, $post ) { | |
if( | |
'publish' === $new_status && | |
'publish' !== $old_status && | |
'post' === $post->post_type |
This file contains hidden or 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
# Вот дерьмо, git, я случайно закоммитил правки в мастер ветку вместо новой! | |
# Создаём новую ветку | |
git branch some-new-branch-name | |
# Удаляем коммит из мастер-ветки | |
git reset HEAD~ --hard | |
# Теперь ваш коммит живет в новой ветке | |
git checkout some-new-branch-name |
This file contains hidden or 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
# Вот дерьмо, git, я закоммитил последние правки, но мне нужно там кое-что поменять! | |
# Вносим правку | |
git add . # или отдельный файл | |
git commit --amend | |
# Следуем подсказкам для изменения или сохранения последнего коммита | |
# Теперь ваш последний коммит содержит нужные вам правки |
This file contains hidden or 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
# Смотрим список последних коммитов во всех ветках, | |
# каждый из которых имеет вид `index HEAD@{index}`. | |
# Выбираем первый коммит перед нашим косячным | |
git reflog | |
# Используем всю магию машины времени | |
git reset HEAD@{index} |
This file contains hidden or 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 | |
// Для начала зарегистрируйте ваш JavaScript-файл без подключения | |
function mihdan_wp_enqueue_scripts() { | |
wp_register_script( 'script-name', plugins_url( '/js/script.js' , __FILE__ ), array(), '1.0.0', true ); | |
} | |
add_action( 'wp_enqueue_scripts', 'mihdan_wp_enqueue_scripts' ); | |
/* *************** */ |
This file contains hidden or 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 | |
function mihdan_disable_plugin_deactivation( $actions, $plugin_file, $plugin_data, $context ) { | |
// Удалить ссылку редактирования исходного кода | |
// для всех плагинов | |
if ( array_key_exists( 'edit', $actions ) ) { | |
unset( $actions[ 'edit' ] ); | |
} | |
// Массив важных плагинов |
This file contains hidden or 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 getFormData($form){ | |
var unindexed_array = $form.serializeArray(); | |
var indexed_array = {}; | |
$.map(unindexed_array, function(n, i){ | |
indexed_array[n['name']] = n['value']; | |
}); | |
return indexed_array; | |
} |
NewerOlder