Skip to content

Instantly share code, notes, and snippets.

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

Kirill Korveld

🏠
Working from home
  • Ukraine
View GitHub Profile
@Korveld
Korveld / change-window-nav.js
Created May 22, 2015 11:59
Navigation change window size function
function changeWindow() {
var $browserWidth = window.innerWidth || document.documentElement.clientWidth;
if ($browserWidth > 980) {
$('nav .right > ul').show();
$('nav .right li.menu-item-has-children').on({
mouseover: function () {
@Korveld
Korveld / ajax-form.js
Created May 22, 2015 14:11
Ajax form js
$(document).ready(function() {
$('#form').submit(function() {
$.ajax({
type: 'POST',
url: 'mail.php',
data: $(this).serialize()
@Korveld
Korveld / mail.php
Created May 22, 2015 14:11
Ajax form php
<?php
$recepient = "volos88@gmail.com";
$sitename = "Ajax форма";
$name = trim($_POST["name"]);
$phone = trim($_POST["phone"]);
$text = trim($_POST["text"]);
$message = "Имя: $name \nТелефон: $phone \nТекст: $text";
@Korveld
Korveld / box-shadow.html
Created June 8, 2015 10:31
CSS3 Box Shadow, only top/right/bottom/left and all
<!DOCTYPE html>
<html>
<head>
<title>Box Shadow</title>
<style>
.box {
height: 150px;
width: 300px;
margin: 20px;
.crossOut
background: url("data:image/svg+xml;utf-8,<svg xmlns='http://www.w3.org/2000/svg' x='0px' y='0px' width='123px' height='51px' viewBox='0 0 123 51' enable-background='new 0 0 123 51' preserveAspectRatio='none' xml:space='preserve'><line fill='none' x1='123' y1='0' x2='0' y2='51' style='stroke:rgb(255,0,0); stroke-width:2' /></svg>") no-repeat scroll 0 0 / 100% 100% transparent
background-repeat: no-repeat
background-position: center center
background-size: 100% 100%, auto
border: solid #f00 2px
padding: 0 !important
http://codepen.io/chriscoyier/pen/zDGkw
@Korveld
Korveld / scroll2object.js
Last active January 19, 2016 11:26
Scroll2object
// Scroll to object
$("#arrow-down").on('click', function(e) {
$('html, body').animate({
scrollTop: $("#descr-section").offset().top
}, 1000);
e.preventDefault();
});
@Korveld
Korveld / sticky-head.js
Last active January 19, 2016 14:47
Sticky header
// Sticky header
$(window).scroll(function() {
if ( $(this).scrollTop() > 0 ) {
$('.top-block').addClass('fixed');
} else if( $(this).scrollTop() == 0 ) {
$('.top-block').removeClass('fixed');
}
});
$('p').each(function() {
var word = $(this).html();
var index = word.indexOf(' ');
if(index == -1) {
index = word.length;
}
$(this).html('<span class="first-word">' + word.substring(0, index) + '</span>' + word.substring(index, word.length));
});
@Korveld
Korveld / nodejs-gulp-install.txt
Created December 19, 2018 16:33 — forked from agragregra/nodejs-gulp-install.txt
Node.js + Gulp installation (Ubuntu) one line command
1. Simple (Node.js LTS, Gulp, rimraf, NCU):
sudo apt-add-repository -y ppa:brightbox/ruby-ng; sudo apt-get update; sudo apt-get -y install curl; curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -; sudo apt-get -y install nodejs; sudo npm i -g gulp rimraf npm-check-updates bower; sudo chown -R $USER:$(id -gn $USER) /home/$USER/.config
2. Advanced (Node.js LTS, Gulp, rimraf, NCU, Ruby, Jekyll, Jekyll paginate)
sudo apt-add-repository -y ppa:brightbox/ruby-ng; sudo apt-get update; sudo apt-get -y install curl ruby2.5 ruby2.5-dev gcc make g++ libffi-dev; curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -; sudo apt-get -y install nodejs; sudo gem i jekyll; sudo gem i jekyll-paginate-v2; sudo npm i -g gulp rimraf npm-check-updates bower; sudo chown -R $USER:$(id -gn $USER) /home/$USER/.config
3. Длинна командной строки (добавить PROMPT_DIRTRIM=3 в конец и сохранить файл):
sudo nano ~/.bashrc
PROMPT_DIRTRIM=3