Skip to content

Instantly share code, notes, and snippets.

View vtu_example.tsx
import { Wrapper, mount, VueClass } from '@vue/test-utils'
import { Component, VueComponent } from '@lms/types'
import { Field } from '@lms-ui/field'
import { DatePicker, Calendar, DatePickerProps } from '..'
/**
* TODO: написать в документацию по тестированию а том, что тестировать clickoutside через document.dispatchEvent приводит к false positive,
* потому что смаунченый компонент может просто бытьне прикреплен к document (даже attachTo: document.body в двух подряд тестах не решает этой проблемы в 1.0.0-beta-33)
*
View gist:658abd243d1718abe56e71a00f68b8e0
const fs = require('fs')
const SVGO = require('svgo')
const svgo = new SVGO({
plugins: [
{ removeXMLNS: true },
{ sortAttrs: true },
{ removeDimensions: true },
],
@voskresla
voskresla / vue-test-utils.d.ts
Created May 26, 2020
vue-test-utils: improve types for typed wrapper.setProps()
View vue-test-utils.d.ts
import { VueClass, ThisTypedMountOptions } from '@vue/test-utils'
import Vue from 'vue'
declare module '@vue/test-utils' {
export interface Wrapper<V, P> extends Wrapper<V> {
setProps(props: Partial<P>): void
}
export declare function mount<V extends Vue, P>(component: VueClass<V>, options?: ThisTypedMountOptions<V, P>): Wrapper<V, P>
}
View xhr-mock
import mock from "xhr-mock";
import fetch from "../src/fetch";
describe("fetch", () => {
beforeEach(() => {
mock.setup();
// mock.error(({ req, err }) => console.log(req.url(), err));
});
afterEach(() => {
@voskresla
voskresla / closestStraightCity.js
Last active Oct 14, 2019
BOLT nearest neighbour
View closestStraightCity.js
// const shaukote = require('./shaukote');
const { performance } = require('perf_hooks');
function closestStraightCity(c, x, y, q) {
let resArray = []; // ["city",..,q]
// HashX: {
// '1': [city:[y,prev,next],city:[y,prev,next],...]
// '2': {city:[y,prev,next],city:[y,prev,next],...}
// }
@voskresla
voskresla / __init.py__
Last active Oct 13, 2019
pyTelegramBotAPI + webhooks + Azure Function
View __init.py__
# Using Azure Functions as webhook for serverless telegram bots.
# (Thanks to twitter.com/masyan for the idea)
# By default the Azure Functions url is https://.../api/HttpTrigger for HttpTrigger type.
# In this example we will use clear webhook url without /api/ -> https://.../HttpTrigger.
# Also we set "authLevel": "anonymous".
# For HttpTrigger type set "route" and "authLevel" in functions.json
# {
# "bindings": [
@voskresla
voskresla / ffmpeg-web-video-guide.md
Created Mar 4, 2019 — forked from jaydenseric/ffmpeg-web-video-guide.md
A quick guide to using FFmpeg to create cross-device web videos.
View ffmpeg-web-video-guide.md

Video conversion with FFmpeg

Install

On mac:

  1. Download the latest release.
  2. Extract the binary and place it in /usr/local/bin.

Command basics

@voskresla
voskresla / encoding-video.md
Created Mar 4, 2019 — forked from Vestride/encoding-video.md
Encoding video for the web
View encoding-video.md

Encoding Video

Installing

Install FFmpeg with homebrew. You'll need to install it with a couple flags for webm and the AAC audio codec.

brew install ffmpeg --with-libvpx --with-libvorbis --with-fdk-aac --with-opus
@voskresla
voskresla / gist:a3f7b21f6b5ab5fe8e28429028eded08
Created Apr 3, 2018
inSales product-color-id hardcoded
View gist:a3f7b21f6b5ab5fe8e28429028eded08
<ul class="product__option--color">
{% assign color_id_array = product.fields.color_id.value | split: ',' %}
{% assign inverse = false %}
{% case product.properties.tsvet.characteristics.first.name %}
{% when 'Белый' %}
{% assign color = 'rgb(255,255,255)' %}
@voskresla
voskresla / gist:c89266d7e64618c123cd506e9130929c
Last active Aug 5, 2020
Shopify link-product-options-in-menus Brooklyn Theme
View gist:c89266d7e64618c123cd506e9130929c
<script>
// (c) Copyright 2016 Caroline Schnapp. All Rights Reserved. Contact: mllegeorgesand@gmail.com
// See https://docs.shopify.com/themes/customization/navigation/link-product-options-in-menus
// Modified by Jonathan Moore (Style Hatch) https://github.com/jonathanmoore
/*
Updated to work with sectioned themes
- Added required methods from the deprecated options_selection.js
- Triggers an initial variant change
- Hides sold out variants with only one option
You can’t perform that action at this time.