Skip to content

Instantly share code, notes, and snippets.

View kovtunos's full-sized avatar

Andrey Kovtun kovtunos

View GitHub Profile
@kovtunos
kovtunos / jquery-filter-by-field.js
Last active September 29, 2017 14:24 — forked from agragregra/jquery-filter-by-field.js
jQuery Input Field Filter #jquery #form
$('.city-input').keyup(function() {
filter(this);
});
function filter(element) {
var value = $(element).val().toLowerCase();
$('[data-filter]').each(function() {
var $this = $(this),
lower = $this.data('filter').toLowerCase();
if (lower.indexOf(value) > -1) {
@kovtunos
kovtunos / .htaccess
Last active September 29, 2017 14:18 — forked from agragregra/.htaccess
htaccess index.html and www redirect #htaccess
RewriteCond %{HTTP_HOST} .
RewriteCond %{HTTP_HOST} www.site.com [NC]
RewriteRule (.*) http://site.com/$1 [R=301,L]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index\.(htm(l)?|php)\ HTTP/
RewriteRule ^(([^/]+/)*)index\.(htm(l)?|php)$ http://site\.com/$1 [R=301,L]
@kovtunos
kovtunos / .htaccess
Last active September 29, 2017 14:18 — forked from agragregra/.htaccess
htaccess wget disable #htaccess
RewriteCond %{HTTP_USER_AGENT} wget [NC]
RewriteRule .* - [F]
@kovtunos
kovtunos / retina.css
Last active May 9, 2017 11:35
Image for Retina display #css #sass
.image {
background-image: url('../images/image.png');
background-size: 400px 200px;
width: 400px;
height: 200px;
}
/* 2 dpr retina monitors */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
.image {
@kovtunos
kovtunos / fix-bootstrap-footer.js
Last active September 29, 2017 14:17
Fix #bootstrap footer to bottom of the page #jquery
@kovtunos
kovtunos / bootstrap-fade-in-mobile-menu.scss
Last active September 29, 2017 14:15
Fade-in mobile menu #bootstrap #css
// Fade in mobile menu
.navbar-collapse {
opacity: 0;
width: auto;
height: auto !important;
max-height: none;
display: block !important;
}
.navbar-collapse.collapse.in {
@kovtunos
kovtunos / radio-buttons.html
Created December 24, 2016 15:04
Radio buttons #css #sass
<div class="container">
<div class="radio">
<input id="radio-1" name="radio" type="radio" checked>
<label for="radio-1" class="radio-label">Checked</label>
</div>
<div class="radio">
<input id="radio-2" name="radio" type="radio">
<label for="radio-2" class="radio-label">Unchecked</label>
</div>
@kovtunos
kovtunos / background-cover.scss
Created December 28, 2016 19:16
Emulate background-cover for inline html img #sass
.cover-image {
overflow: hidden;
position: relative;
top: 0;
right: 0;
bottom: 0;
left: 0;
height: 150px;
@kovtunos
kovtunos / slug-class.js
Last active March 4, 2017 09:00
Add page class based on slug #js #jquery
var getSlug = window.location.href.substr(window.location.href.lastIndexOf("/") + 1);
$('body').addClass('page--' + getSlug);
@kovtunos
kovtunos / list-big-circles.scss
Last active January 12, 2017 20:09
Larger circles on bullet list #ul #sass
.list-circles {
li {
position: relative;
list-style: none;
font-size: 1rem;
line-height: 1rem;
&::before {
position: absolute;
top: 0;