Skip to content

Instantly share code, notes, and snippets.

View Dexdot's full-sized avatar
🏠
Working from home

Kam Dexdot

🏠
Working from home
View GitHub Profile
<div class="cd-modal" data-modal="modal-trigger">
<div class="cd-svg-bg"
data-step1="M-59.9,540.5l-0.9-1.4c-0.1-0.1,0-0.3,0.1-0.3L864.8-41c0.1-0.1,0.3,0,0.3,0.1l0.9,1.4c0.1,0.1,0,0.3-0.1,0.3L-59.5,540.6 C-59.6,540.7-59.8,540.7-59.9,540.5z"
data-step2="M33.8,690l-188.2-300.3c-0.1-0.1,0-0.3,0.1-0.3l925.4-579.8c0.1-0.1,0.3,0,0.3,0.1L959.6,110c0.1,0.1,0,0.3-0.1,0.3 L34.1,690.1C34,690.2,33.9,690.1,33.8,690z"
data-step3="M-465.1,287.5l-0.9-1.4c-0.1-0.1,0-0.3,0.1-0.3L459.5-294c0.1-0.1,0.3,0,0.3,0.1l0.9,1.4c0.1,0.1,0,0.3-0.1,0.3 l-925.4,579.8C-464.9,287.7-465,287.7-465.1,287.5z"
data-step4="M-329.3,504.3l-272.5-435c-0.1-0.1,0-0.3,0.1-0.3l925.4-579.8c0.1-0.1,0.3,0,0.3,0.1l272.5,435c0.1,0.1,0,0.3-0.1,0.3 l-925.4,579.8C-329,504.5-329.2,504.5-329.3,504.3z"
data-step5="M341.1,797.5l-0.9-1.4c-0.1-0.1,0-0.3,0.1-0.3L1265.8,216c0.1-0.1,0.3,0,0.3,0.1l0.9,1.4c0.1,0.1,0,0.3-0.1,0.3L341.5,797.6 C341.4,797.7,341.2,797.7,341.1,797.5z"
data-step6="M476.4,1013.4L205,580.3c-0.1-0.1,0-0.3,0.1-0.3L1130.5,0.2c0.1-0.1,0.3,0,0
@Dexdot
Dexdot / gradient_less_mixin.scss
Last active August 10, 2017 19:04
gradient scss mixin
/* gradient */
@mixin gradient($from: #000, $to: #fff) {
background-color: $from;
background-image: -webkit-gradient(linear, left top, left bottom, from($from), to($to));
background-image: -webkit-linear-gradient(top, $from, $to);
background-image: -moz-linear-gradient(top, $from, $to);
background-image: -o-linear-gradient(top, $from, $to);
background-image: linear-gradient(to bottom, $from, $to);
}
@Dexdot
Dexdot / common.js
Created August 19, 2017 19:09
Types Conversion
"" + 1 + 0 // "10" Оператор "+" в данном случае прибавляет 1 как строку, и затем 0.
"" - 1 + 0 // -1 Оператор "-" работает только с числами, так что он сразу приводит "" к 0.
true + false // 1
6 / "3" // 2
"2" * "3" // 6
4 + 5 + "px" // "9px"
"$" + 4 + 5 // "$45"
"4" - 2 // 2
@Dexdot
Dexdot / main.js
Created August 20, 2017 22:17
jquery media queries
// Media queries
var handleMatchMedia = function (mediaQuery) {
if (mediaQuery.matches) {
$('.platform-feature.slideInDown').removeClass('slideInDown').addClass('slideInLeft');
$('.platform-feature.slideInUp').removeClass('slideInUp').addClass('slideInRight');
}
};
mql = window.matchMedia('all and (max-width: 594px)');
handleMatchMedia(mql);
mql.addListener(handleMatchMedia);
<?php
$whatever=$_POST['whatever'];
$username=$_POST['username'];
$phone=$_POST['phone'];
$message = "
Имя формы: ".htmlspecialchars($whatever)."<br />
Имя пользователя: ".htmlspecialchars($username)."<br />
Телефон: ".htmlspecialchars($phone);
require_once('prod/vendor/phpmailer/PHPMailerAutoload.php');
@Dexdot
Dexdot / gist:ef5be56164bf6d639d85edcaef452d9d
Last active August 24, 2017 17:01
Hamburger menu + simple mobile menu
// Markup
<nav>
<ul class="nav">
<li><a href="#main" class="nav__link">Home</a></li>
<li><a href="#about" class="nav__link">About</a></li>
<li><a href="#" class="nav__link">Contacts</a></li>
<li><a href="#" class="nav__link">Portfolio</a></li>
<li><a href="#" class="nav__link">Feeback</a></li>
</ul>
<button class="hamburger hamburger--elastic" type="button">
$(function() {
var sectionHeight = $('#section-1').height(); // current section height
$(window).scroll(function(event) { // scroll event
var top = $(this).scrollTop(); // px from top
if (top == sectionHeight) { // when length from top equals current section height, we load new sections
$('.container').load('./sections.html #section-2'); // only second section
$('.container').load('./sections.html'); // or ALL section from section.html
}
});
$(function() {
var userName = $('form input').val();
$.ajax({
url: './send.php',
type: 'GET',
dataType: 'html',
data: {name: userName},
})
.done(function(data) {
console.log(data);
@Dexdot
Dexdot / ytb-rspnsv
Created September 13, 2017 16:56
Youtube responsive
// Youtube fluid
// Find all YouTube videos
var $allVideos = $("iframe[src^='//www.youtube.com']"),
$fluidEl = $(".process__video"); // video-container (change it)
$allVideos.each(function() {
$(this)
.data('aspectRatio', this.height / this.width)
.removeAttr('height')
.removeAttr('width');
});
@Dexdot
Dexdot / ytb-rspnsv-2
Created September 13, 2017 17:02
Responsive YouTube #2 variant
&__video {
width: 100%;
position: relative;
padding-bottom: 56.25%; /* 16:9 */
padding-top: 25px;
height: 0;
iframe {
position: absolute;
top: 0;
left: 0;