Skip to content

Instantly share code, notes, and snippets.

View sxidsvit's full-sized avatar

Sergiy Antonyuk sxidsvit

View GitHub Profile
@sxidsvit
sxidsvit / partials.scss
Created May 10, 2016 01:59
Пример использования переменных в SCSS. Можем управлять цветом, лайаутом, типографикой, кнопками.
// === Freebie: “Synthetica” One Page Website Template (HTML, Sketch) ==
// http://tympanus.net/codrops/2016/04/29/freebie-synthetica-one-page-website-template/
==== _colors.scss ===
$white: #ffffff; //white
$black: #000000; //black
$slate: #414A52; //body font
$light-slate: #5E6265;
$light-grey: #F4F6F9; //light section
$dark-grey: #8A9097;
@sxidsvit
sxidsvit / ajax-form sending
Last active June 7, 2016 11:17
Отправка ajax-формы
$(document).ready(function(){
$('form#contact-form').submit(function(e){
e.preventDefault();
var msg = $(this).serialize();
var action = $(this).attr('action');
$.ajax({
type: "POST",
url: action,
data: msg,
success: function(data) {
@sxidsvit
sxidsvit / $modx - newQuery(modTemplateVarResource)
Last active June 7, 2016 21:15
Выборка значений TV-параметра из таблицы MODx (А.Петропавловский)
<?php
$tvid = 9;
$res = array();
$temp = array();
$output = '';
$q = $modx->newQuery('modTemplateVarResource', array('tmplvarid' => $tvid));
$q -> select('contentid, value');
if ($q->prepare() && $q->stmt->execute()) {
while ($row = $q->stmt->fetch(PDO::FETCH_ASSOC)) {
@sxidsvit
sxidsvit / sql_pdo_class
Last active December 9, 2016 06:41
Класс для работы с БД на основе PDO. + CURL + парсинг сайтов
================================ SQL.php -класс для работы с БД. Bспользутся PDO ========================================
==== PHP Data Objects. Данное расширение предоставляет доступ к Базам Данных используя объекты =======
<?php
class SQL {
private static $instance = null;
private $db ;
public static function Instance() {
@sxidsvit
sxidsvit / button.sass
Created March 28, 2017 04:26 — forked from agragregra/button.sass
Button Sass Styles (Universal Starter)
.button
display: inline-block
border: none
color: #fff
text-decoration: none
background-color: $accent
padding: 15px 45px
font-size: 13px
text-transform: uppercase
font-weight: 600
@sxidsvit
sxidsvit / Yandex.Map background loading
Created May 2, 2017 02:12
Yandex.Map background loading
<!-- Ускоряем загрузку: фоновая загрузка Яндекс.Карты - https://www.megaindex.org/speed -->
<meta http-equiv="x-dns-prefetch-control" content="">
<link rel="dns-prefetch" href="https://api-maps.yandex.ru/services/constructor/1.0/js/">
@sxidsvit
sxidsvit / index.html
Created June 11, 2017 16:36
Typed effect for text (text typing animation)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Typed effect</title>
</head>
<body>
<div class="element"></div>
@sxidsvit
sxidsvit / meta_title_for_product.php
Last active December 9, 2017 01:28
Добавление дополнительных полей к таксономии вручную
<?php
// Добавление дополнительных полей к таксономии $taxname
// и создание фильтра для вывод пользовательского поля title в заголовок страницы архива
// Название (слаг, id ) таксономии, к которой будем добавлять поля
$taxname = 'product_cat';
// Поля при добавлении элемента таксономии
add_action("{$taxname}_add_form_fields", 'add_new_custom_fields');
// Поля при редактировании элемента таксономии
@sxidsvit
sxidsvit / parallax.js
Created December 9, 2017 05:45
Background Parallax - классический параллакс фона
// Background Parallax
var $window = $(window);
if($('section[data-type="background"]').length){
$('section[data-type="background"]').each(function(){
var $obj = $(this);
var offset = $obj.offset().top;
$(window).scroll(function()
{
@sxidsvit
sxidsvit / select_product_cat_template.php
Last active December 12, 2017 08:15
Выбор шаблона для элементов/термов заданной таксономии
<?php
/*
Идущий НИЖЕ код можно вставить в файл custom_functions.php или ВЕСЬ файл подключить в custom_functions.php, используя код
if(file_exists(dirname( __FILE__ ).'/select_product_cat_template.php')){ include_once 'select_product_cat_template.php'; }
*/
add_action('template_redirect', 'select_product_cat_template');
function select_product_cat_template() {