Skip to content

Instantly share code, notes, and snippets.

View sioniks's full-sized avatar
👻
...

Oleksandr sioniks

👻
...
View GitHub Profile
@sioniks
sioniks / example-input.html
Created September 17, 2020 22:59 — forked from stowball/example-input.html
Fetch a remote SVG as an <img> and convert it to an inline SVG
<img
alt="accessible text"
class="fill-color-red"
height="16"
src="some.svg"
width="16"
onload="fetchSvgInline(this)"
/>
@sioniks
sioniks / convert.js
Created March 17, 2020 10:44
convert HEX to rgba Vue.js
data: {
return {
opacity: 50
}
},
methods: {
convertHex: function (color) {
color = color.replace('#', '')
let r = parseInt(color.substring(0, 2), 16)
let g = parseInt(color.substring(2, 4), 16)
@sioniks
sioniks / keyEventReport.js
Created February 5, 2020 14:31
report key event
function reportKeyEvent (zEvent) {
var keyStr = ["Control", "Shift", "Alt", "Meta"].includes(zEvent.key) ? "" : zEvent.key + " ";
var reportStr =
"The " +
( zEvent.ctrlKey ? "Control " : "" ) +
( zEvent.shiftKey ? "Shift " : "" ) +
( zEvent.altKey ? "Alt " : "" ) +
( zEvent.metaKey ? "Meta " : "" ) +
keyStr + "key was pressed."
;
@sioniks
sioniks / MixinHotKeys.js
Created February 5, 2020 14:02
vue hotkey mixin
export const hotkeys = {
created() {
document.addEventListener("keydown", this.doCommand);
},
destroyed() {
document.removeEventListener("keydown", this.doCommand);
},
methods: {
showHeplHandler() {
this.popupHandler("hotKeyHelper");
@sioniks
sioniks / media.sass
Last active December 31, 2019 01:50
media file sass #sass
$information-large-devise: "only screen and (max-width : 1200px)"
$information-medium-devise: "only screen and (max-width : 992px)"
$information-small-devise: "only screen and (max-width : 768px)"
$information-esmall-devise: "only screen and (max-width : 480px)"
$information-custom-devise: "only screen and (max-width : 320px)"
$information2-large-devise: "only screen and (min-width : 1200px)"
$information2-medium-devise: "only screen and (min-width : 992px)"
$information2-small-devise: "only screen and (min-width : 768px)"
$information2-esmall-devise: "only screen and (min-width : 480px)"
@sioniks
sioniks / hex_to_rgb
Created August 7, 2019 07:20
#color #convert
const hexToRgb = hex =>
hex.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i
,(m, r, g, b) => '#' + r + r + g + g + b + b)
.substring(1).match(/.{2}/g)
.map(x => parseInt(x, 16))
@sioniks
sioniks / symbols.js
Created August 5, 2019 12:06
symbol svg #svg #symbol
<svg style="display:none">
<symbol id="icon-copy" viewBox="0 0 32 32">
<path
d="M20 8v-8h-14l-6 6v18h12v8h20v-24h-12zM6 2.828v3.172h-3.172l3.172-3.172zM2 22v-14h6v-6h10v6l-6 6v8h-10zM18 10.828v3.172h-3.172l3.172-3.172zM30 30h-16v-14h6v-6h10v20z">
</path>
</symbol>
</svg>
@sioniks
sioniks / gulpfile.js
Created July 22, 2019 06:55 — forked from nandunbandara/gulpfile.js
FTP Upload to remote server
'use strict';
var gulp = require('gulp');
var gutil = require('gulp-util');
var ftp = require('vinyl-ftp');
var user = process.env.FTP_USER;
var pwd = process.env.FTP_PWD;
var localFiles = [
@sioniks
sioniks / .htaccess
Last active June 10, 2019 20:45
Включение кэша браузера Wordpress
Включение кеша браузера
=====
Вариант 1
===
<ifModule mod_headers.c>
<FilesMatch "\.(js|css|txt)$">
Header set Cache-Control "max-age=604800"
</FilesMatch>
<FilesMatch "\.(flv|swf|ico|gif|jpg|jpeg|png)$">
Header set Cache-Control "max-age=2592000"
@sioniks
sioniks / mixin.scss
Created February 7, 2019 14:33
media scss
$tablet: 768px; //tablet
// $tablet-l: 1700px; //tablet, tablet landscape, small pc
$laptop: 1200px; //pc, laptop
$dmac: 1400px; // stupid mac
$desctop: 1600px; //pc (*optional)
$lagre: 1900px; //large view port width pc (*optional)
@mixin respond-to($media) {
@if $media==t {