Skip to content

Instantly share code, notes, and snippets.

View DragorWW's full-sized avatar

Andreev Sergey DragorWW

View GitHub Profile
@DragorWW
DragorWW / list-cd
Last active January 3, 2016 21:18
comma, comma, dot. list
.list-cd {margin-right: 0,5em;}
.list-cd::after {content: ', '; position: absolute;}
.list-cd:after {content: '.';}
@DragorWW
DragorWW / no-event
Last active January 3, 2016 23:29
disable event for dom element (event proxy)
.no-event {
pointer-events: none; // IE9, IE10, webkit, fireFox
}
@DragorWW
DragorWW / jq-event-return-false
Created January 21, 2014 09:24
jquery event return false
$('.elm').click(function(e) {
e.preventDefault();
e.stopPropagation(); // stop other event for this elm
});
(function($){
var hasTouch = /android|iphone|ipad/i.test(navigator.userAgent.toLowerCase()),
eventName = hasTouch ? 'touchend' : 'click';
/**
* Bind an event handler to the "double tap" JavaScript event.
* @param {function} doubleTapHandler
* @param {number} [delay=300]
*/
@DragorWW
DragorWW / placeholder
Created January 22, 2014 09:35
scss placeholder mixim
@mixin placeholder {
&.placeholder { @content; }
&:-moz-placeholder { @content; }
&::-moz-placeholder { @content; }
&::-webkit-input-placeholder { @content; }
}
@DragorWW
DragorWW / check-inpuefile
Created January 23, 2014 12:48
input file not work in iOS <6 check
var isFileInputSupported = (function () {
// Handle devices which falsely report support
if (navigator.userAgent.match(/(Android (1.0|1.1|1.5|1.6|2.0|2.1))|(Windows Phone (OS 7|8.0))|(XBLWP)|(ZuneWP)|(w(eb)?OSBrowser)|(webOS)|(Kindle\/(1.0|2.0|2.5|3.0))/)) {
return false;
}
// Create test element
var el = document.createElement("input");
el.type = "file";
return !el.disabled;
})();
@DragorWW
DragorWW / scss gray filter
Created January 28, 2014 09:54
scss gray filter
@mixin
filter: url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\'><filter id=\'grayscale\'><feColorMatrix type=\'matrix\' values=\'0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0\'/></filter></svg>#grayscale") /* Firefox 10+, Firefox on Android */
filter: gray /* IE6-9 */
-webkit-filter: grayscale(100%) /* Chrome 19+, Safari 6+, Safari 6+ iOS */
&:hover
filter: url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\'><filter id=\'grayscale\'><feColorMatrix type=\'matrix\' values=\'1 0 0 0 0, 0 1 0 0 0, 0 0 1 0 0, 0 0 0 1 0\'/></filter></svg>#grayscale")
-webkit-filter: grayscale(0%)
@DragorWW
DragorWW / function.php
Created May 19, 2014 04:59
Add custom tyneMCE style in wordpress
// TyneMCE options :
// - editor style
function add_editor_styles() {
add_editor_style( 'css/editor-style.css' );
}
add_action( 'init', 'add_editor_styles' );
// - add custom style
add_filter( 'mce_buttons_2', 'mce_editor_buttons' );
function mce_editor_buttons( $buttons ) {
@DragorWW
DragorWW / no-select-text.css
Created May 19, 2014 09:28
disable select text css
.no-select-text {
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
@DragorWW
DragorWW / template.js
Last active August 29, 2015 14:02
Template.JS - template engine
/**
* Template.JS v 0.1
* @author Andreev Sergey
* @corp USERSTORY
*/
(function($) {
/**
* Template engine class
* @param {string} tpl template name
* @param {array} o @optional options array