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 / 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 / for_react
Last active April 8, 2019 14:11
For react
- progress_bar -- https://github.com/milworm/react-progress-2
@sioniks
sioniks / under.css
Created February 14, 2019 22:42
Hover underline animation #hover #animation
.hover-underline-animation {
display: inline-block;
position: relative;
color: #0087ca;
}
.hover-underline-animation::after {
content: '';
position: absolute;
width: 100%;
transform: scaleX(0);