Skip to content

Instantly share code, notes, and snippets.

View a-zhary's full-sized avatar
💻
Happy Coding

Anton Zhary a-zhary

💻
Happy Coding
View GitHub Profile
@a-zhary
a-zhary / wp-sync.sh
Created October 5, 2023 06:08 — forked from tacone/wp-sync.sh
Quick script to sync your dev box to a production Wordpress
#!/bin/bash
# Syncronize a local Wordpress installation with a remote one.
#
#
# Requires wp-cli.phar installed somewhere.
WP_CLI=/usr/local/bin/wp
# Remote settings
@a-zhary
a-zhary / gutenberg-helpers.js
Created June 2, 2023 18:18 — forked from KevinBatdorf/gutenberg-helpers.js
WordPress check Gutenberg editor is ready
import { select, subscribe } from '@wordpress/data'
export function whenEditorIsReady() {
return new Promise((resolve) => {
const unsubscribe = subscribe(() => {
// This will trigger after the initial render blocking, before the window load event
// This seems currently more reliable than using __unstableIsEditorReady
if (select('core/editor').isCleanNewPost() || select('core/block-editor').getBlockCount() > 0) {
unsubscribe()
resolve()
@a-zhary
a-zhary / parse_utm.js
Created September 23, 2021 02:02 — forked from hunty/parse_utm.js
Парсит UTM метки и подставляет в скрытые поля
window.onload = function() {
// Parse the URL
function getParameterByName(name) {
var name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)");
var results = regex.exec(location.search);
return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
}
// Give the URL parameters variable names
var source = getParameterByName('utm_source');
<?php
$args = array(
'label' => '', // Text in Label
'class' => '',
'style' => '',
'wrapper_class' => '',
'value' => '', // if empty, retrieved from post meta where id is the meta_key
'id' => '', // required
'name' => '', //name will set from id if empty
@a-zhary
a-zhary / bootstrap-4-sass-mixins-cheat-sheet.scss
Created June 29, 2020 22:28 — forked from anschaef/bootstrap-4-sass-mixins-cheat-sheet.scss
Bootstrap 4 Sass Mixins [Cheat sheet with examples]
/* -------------------------------------------------------------------------- */
// All Bootstrap 4 Sass Mixins [Cheat sheet]
// Updated to Bootstrap v4.5.x
// @author https://anschaef.de
// @see https://github.com/twbs/bootstrap/tree/master/scss/mixins
/* -------------------------------------------------------------------------- */
// Grid variables
$grid-columns: 12;
$grid-gutter-width: 30px;
@a-zhary
a-zhary / svgdraw.js
Created May 27, 2017 22:08 — forked from agragregra/svgdraw.js
SVG Animate
var path = document.querySelector('path');
var length = path.getTotalLength();
// Clear any previous transition
path.style.transition = path.style.WebkitTransition =
'none';
// Set up the starting positions
path.style.strokeDasharray = length + ' ' + length;
path.style.strokeDashoffset = length;
// Trigger a layout so styles are calculated & the browser
// picks up the starting position before animating
SASS:
.mfp-ready .mfp-figure
opacity: 0
.mfp-zoom-in
.mfp-figure, .mfp-iframe-holder .mfp-iframe-scaler
opacity: 0
transition: all 0.3s ease-out
transform: scale(0.95)
&.mfp-bg, .mfp-preloader
opacity: 0
@a-zhary
a-zhary / scroll-next.js
Created May 27, 2017 22:06 — forked from agragregra/scroll-next.js
jQuery Scroll To Next Section
$(".scroll-next").click(function() {
var cls = $(this).closest(".section").next().offset().top;
$("html, body").animate({scrollTop: cls}, "slow");
});
@a-zhary
a-zhary / gulpfile.js
Created May 17, 2017 00:21 — forked from evanre/gulpfile.js
Wordpress gulpfile.js
var
// global
gulp = require('gulp'),
watch = require('gulp-watch'),
browserSync = require("browser-sync"),
reload = browserSync.reload,
sass = require('gulp-sass'),
prefixer = require('gulp-autoprefixer'),
cssnano = require('gulp-cssnano'),
$(".tab_item").not(":first").hide();
$(".wrapper .tab").show().click(function() {
var ind = $(this).index();
$(".wrapper .tab").removeClass("active").eq(ind).addClass("active");
$(".tab_item").hide().eq(ind).fadeIn()
}).eq(0).addClass("active");
<div class="wrapper">
<div class="tabs">
<span class="tab">Вкладка 1</span>