Skip to content

Instantly share code, notes, and snippets.

View evanre's full-sized avatar
👨‍💻
Code is poetry.

Yevhen Zhuchenko evanre

👨‍💻
Code is poetry.
View GitHub Profile
@evanre
evanre / superhover.scss
Last active January 25, 2016 17:52
Mixin that extends all action states :hover, :active, :focus (SASS, SCSS)
// Extends all action states :hover, :active, :focus.
@mixin superhover {
&:hover,
&:active,
&:focus {
@content;
}
}
<!--[if lte IE 9]>
<div class="browserupgrade__overlay">
<div class="browserupgrade">
<p class="browserupgrade__sory">Sorry, your browser is too old</p>
<p class="browserupgrade__text">It seems that you are using <strong>outdated and insecure</strong> version of
Internet Explorer. This version of the browser does not support many advanced technologies, because of which
many pages are displayed incorrectly.<br>Please, <a href="http://www.whatbrowser.org/intl/en/" target="_blank">
upgrade your browser</a>, <br> to get a better impression of the Network.</p>
<a href="http://www.whatbrowser.org/intl/en/" class="browserupgrade__btn" target="_blank">Upgrade browser</a>
</div>
@evanre
evanre / material.scss
Created June 22, 2016 18:03
Material shadow
//
// Computes a top-shadow for a card effect.
// @param {Number} $depth - depth level
// @return {List}
//
@function top-shadow($depth) {
$primary-offset: nth(1.5 3 10 14 19, $depth) * 1px;
$blur: nth(1.5 3 10 14 19, $depth) * 4px;
$color: rgba(black, nth(.12 .16 .19 .25 .30, $depth));
@evanre
evanre / wp-config.php
Created July 2, 2016 11:25
WordPress: Set WordPress site URL in the config file instead of the database
<?php
// WordPress stores the site URL in the database by default (which I have never
// understood), and it's a pain to have to type out the UPDATE SQL or search in
// phpMyAdmin to change it. This is a simple way to put the URL into
// wp-config.php instead.
// Note that you will still need to update any URLs that appear in the content,
// especially when you copy a database from a development site to production:
// https://gist.github.com/davejamesmiller/a8733a3fbb17e0ff0fb5
@evanre
evanre / Scroll-to-top-button.html
Last active July 14, 2016 13:24
Scroll to top button
<!--Add to footer-->
<a href="#" class="scrollup">
<span>Scroll up</span>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M6.582,12.141c-0.271,0.268-0.709,0.268-0.978,0c-0.269-0.268-0.272-0.701,0-0.969l3.908-3.83c0.27-0.268,0.707-0.268,0.979,0l3.908,3.83c0.27,0.267,0.27,0.701,0,0.969c-0.271,0.268-0.709,0.268-0.979,0L10,9L6.582,12.141z"/></svg>
</a>
{
// With this option enabled, all Emmet's CSS snippets
// will be available in standard auto-complete popup
"show_css_completions": true,
// If set to `true`, Emmet will automatically insert final tabstop
// at the end of expanded abbreviation
"insert_final_tabstop": false,
///////////////////////////////
@evanre
evanre / header.html
Last active August 19, 2016 18:08
Show sticky header when start to scrollup
<div id="page" class="site">
<header id="masthead" class="site-header" role="banner"></header>
</div>
@evanre
evanre / sql-dump.php
Last active August 25, 2016 00:54
Use this method, if you need site database, but you have access to site only via ftp (and no access to mysqlserver\phpmyadmin\cli). Copy file to site root, paste db acces info to string (delete double underscores), and open in browser http://site.com/sql-dump.php. Done. Warning! It's VERY unsafe to leave file on server. Make your dump and delete…
<?php
// Make dump of database via php
exec('mysqldump --user=__user_name__ --password=__user_pass__ --host=__host(localhost)__ __db_name__ > dump.sql');
print_r('Dump saved');
@evanre
evanre / smooth_scrolling.js
Last active February 23, 2017 23:23
Smooth Scrolling to #anchor from Chris Coyier
$(function() {
$('a[href*="#"]:not([href="#"])').click(function () {
if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
var target = $(this.hash);
target = target.length ? target : $('[name=' + this.hash.slice(1) +']');
if (target.length) {
$('html,body').animate({
scrollTop: target.offset().top
}, 1000);
return false;
@mixin valid-quantity($quantity) {
@if type-of($quantity) != 'number' {
@error 'The "quantity" parameter must be a number!';
}
@if not(unitless($quantity)) {
@error 'The "quantity" parameter must not have a unit!';
}
@if $quantity < 0 {
@error 'The "quantity" parameter must be at least 0!';
}