This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function ellipsizeTextBox(id, height) { | |
var el = document.getElementById(id); | |
el.style.maxHeight = height; | |
var wordArray = el.innerHTML.split(' '); | |
if (height) { | |
el.style.maxHeight = height; | |
} | |
while(el.scrollHeight > el.offsetHeight) { | |
wordArray.pop(); | |
el.innerHTML = wordArray.join(' ') + '...'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function (number) { | |
var cases = [2, 0, 1, 1, 1, 2]; | |
var titles = ['год', 'года', 'лет']; | |
return number + " " + titles[(number % 100 > 4 && number % 100 < 20) ? 2 : cases[(number % 10 < 5) ? number % 10 : 5]]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" auto reload .vimrc when changed, this avoids reopening vim | |
autocmd! bufwritepost .vimrc source % | |
set nocompatible " be iMproved, required | |
filetype on " required | |
" set the runtime path to include Vundle and initialize | |
set rtp+=~/.vim/bundle/Vundle.vim | |
call vundle#begin() | |
" alternatively, pass a path where Vundle should install plugins |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//- Declaration | |
mixin pet(name) | |
li.pet= name | |
//- Use | |
ul | |
+pet('cat') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This is my Atom settings. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// jQuery addClass on scroll | |
var section1 = $('.css-class').offset().top; | |
var section2 = $('.css-class-2').offset().top; | |
$(window).scroll(function(){ | |
//section-1 | |
if( $(window).scrollTop() > section1 ) { | |
$('.css-class').addClass('active'); //добавить класс, когда проскроллил элемент. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- HTML --> | |
<form> | |
<!-- Hidden Required Fields --> | |
<input type="hidden" name="project_name" value="Site Name"> | |
<input type="hidden" name="admin_email" value="[email protected]"> | |
<input type="hidden" name="form_subject" value="Form Subject"> | |
<!-- END Hidden Required Fields --> | |
<input type="text" name="Name" placeholder="You name..." required><br> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('a[href^="#"]').on("click", function(){ | |
var the_id = $(this).attr("href"); | |
$('html, body').animate({ | |
scrollTop:$(the_id).offset().top | |
}, 'slow'); | |
return false; | |
}); |
NewerOlder