Skip to content

Instantly share code, notes, and snippets.

View avdoshenkov's full-sized avatar

Dmitry Avdoshenkov avdoshenkov

View GitHub Profile
@avdoshenkov
avdoshenkov / fa-for-li.css
Last active August 11, 2017 05:55
FontAwesome icon for li via ::before
:before {
content: "";
position: absolute;
top: 50%;
left: 0;
transform: translateY(-50%);
font-family: FontAwesome;
content: "\f000";
display: inline-block;
}
@avdoshenkov
avdoshenkov / icon-for-li.css
Last active August 11, 2017 05:54
Menu with image icon for li via ::before
ul {
list-style: none;
}
ul li {
position: relative;
}
ul li:before {
content: "";
position: absolute;
top: 50%;
@avdoshenkov
avdoshenkov / flex-12col-grid.css
Last active February 25, 2018 07:10
Flexbox layout grid x CSS Custom properties
/* Originally from: https://codepen.io/MadeByMike/pen/ZyxwLm/ */
:root {
--row-display: block;
--row-display: flex;
--col-basis: 100%;
}
@media (min-width: 800px) {
:root {
@avdoshenkov
avdoshenkov / btn-hov.css
Last active August 11, 2017 05:51
Universal color changing on hover for buttons
.btn {
background-color: green;
}
.btn:hover,
.btn:focus {
box-shadow: inset 0 0 100px 100px rgba(255, 255, 255, 0.1);
}
@avdoshenkov
avdoshenkov / getx-styles.php
Created August 11, 2017 06:06
Adding new stylesheet (e.g. redesign) through http://example.com/?x
<?php if (isset($_GET['x'])) {
echo '<link href="path/to/style_new.css" rel="stylesheet">';
} else {
echo '<link href="path/to/style.css" rel="stylesheet">';
}
?>
@avdoshenkov
avdoshenkov / ym-jquery-onclick.js
Created August 11, 2017 07:42
Yandex.Metrics jquery onclick aim
$('.btn').click(function() {
yaCounter00000000.reachGoal('form-open');
});
@avdoshenkov
avdoshenkov / ym-wpcf7-sent.js
Created August 11, 2017 07:45
Yandex.Metrics aim for sent form via Contact Form 7 event
document.addEventListener( 'wpcf7mailsent', function( event ) {
switch (event.detail.contactFormId) {
case '111':
yaCounter00000000.reachGoal('form1-sent');
break;
case '222':
yaCounter00000000.reachGoal('form2-sent');
break;
default:
break;
@avdoshenkov
avdoshenkov / ym-af-modx-sent.js
Last active August 11, 2017 07:58
Yandex.Metrics aim on sent form via AjaxForm event in MODX
$(document).on('af_complete', function(event, response) {
var form = response.form;
// Если у формы определённый class
if (form.hasClass('ajax-form') && response.success) {
yaCounter00000000.reachGoal('form-sent');
}
});
@avdoshenkov
avdoshenkov / cookie.js
Last active August 31, 2017 11:25
Create and read cookie funcs
@avdoshenkov
avdoshenkov / .gitlab-ci.yml
Last active February 26, 2020 20:15
Gitlab CI deploy config for Gatsby JS site and Amazon S3
image: node:latest
stages:
- build
- deploy
variables:
BUCKET_NAME: bucket-name
cache: