Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

Yarkov Aleksey yarkovaleksei

Block or report user

Report or block yarkovaleksei

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@yarkovaleksei
yarkovaleksei / dom-to-json.js
Created Apr 5, 2019 — forked from sstur/dom-to-json.js
Stringify DOM nodes using JSON (and revive again)
View dom-to-json.js
function toJSON(node) {
node = node || this;
var obj = {
nodeType: node.nodeType
};
if (node.tagName) {
obj.tagName = node.tagName.toLowerCase();
} else
if (node.nodeName) {
obj.nodeName = node.nodeName;
View vuelidate.d.ts
declare module 'vuelidate' {
// we need to augment the actual Vue types
import vue from 'vue'
// must bolt on the validations property to the input of ComponentOptions
// and also onto the "output" of @Component in the form of VueClass<Vue>
module 'vue/types/options' {
// tslint:disable-next-line
interface ComponentOptions<V extends vue> {
validations?: { [x: string]: any }
View RadialProgressBar.spec.ts
import { mount } from '@vue/test-utils'
import RadialProgressBar from './RadialProgressBar.vue'
let wrapper: any
describe('ui/primitives/RadialProgressBar', () => {
beforeEach(() => {
wrapper = mount(RadialProgressBar, {
propsData: {
size: 18,
View Highlight.spec.ts
import { mount } from '@vue/test-utils'
import Highlight from './Highlight.vue'
let wrapper: any
describe('ui/Highlight', () => {
beforeEach(() => {
wrapper = mount(Highlight, {
propsData: {
search: '',
View checkBraces.js
/**
* See demo (https://jsfiddle.net/yarkov_aleksei/e4Lwoq1g/)
*/
const braces = [['{', '}'], ['[', ']'], ['(', ')'], ['<', '>']]
const strBraces = braces.map(b => b.join('')).join('')
function isOpen(char) {
for (let i = 0; i < braces.length; i++) {
if (braces[i][0] === char) {
@yarkovaleksei
yarkovaleksei / 1. Example.scss
Created May 18, 2018 — forked from Integralist/1. Example.scss
Sass Mixin for CSS3 Animations
View 1. Example.scss
@include keyframe(fadeout) {
0% {
opacity: 1;
}
100% {
opacity: 0;
}
}
View client.ts
import socketIo = require('socket.io-client')
const client = socketIo.connect('http://localhost:8080')
setInterval(() => {
client.emit('custom_stream', Buffer.from('aaaa'))
}, 1000)
@yarkovaleksei
yarkovaleksei / class_decorator.ts
Created Apr 26, 2018 — forked from remojansen/class_decorator.ts
TypeScript Decorators Examples
View class_decorator.ts
function logClass(target: any) {
// save a reference to the original constructor
var original = target;
// a utility function to generate instances of a class
function construct(constructor, args) {
var c : any = function () {
return constructor.apply(this, args);
}
View jwtParse.js
function parseJwt (token) {
const base64Url = token.split('.')[1]
const base64 = base64Url.replace('-', '+').replace('_', '/')
return JSON.parse(window.atob(base64))
}
const token = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjVhNGQxMWExNjQ0ZWZmMDAwMTI0ZjA1ZiIsImlhdCI6MTUyMzYzNTgyOSwiZXhwIjoxNTIzNzIyMjI5fQ.Vhfcry3B9fqP1MmZ9Sz_VZK8FfVOwQ72MoGyvR0idNU'
console.clear()
console.log(parseJwt(token))
View gist:d67f3a06e0ba803d95522276bd784c68
.container {
width: 100%;
padding-right: 15px;
padding-left: 15px;
margin-right: auto;
margin-left: auto;
}
@media (min-width: 576px) {
.container {
You can’t perform that action at this time.