Skip to content

Instantly share code, notes, and snippets.

View voskresla's full-sized avatar

Stepan voskresla

View GitHub Profile
@voskresla
voskresla / gist:a3f7b21f6b5ab5fe8e28429028eded08
Created April 3, 2018 13:27
inSales product-color-id hardcoded
<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 / encoding-video.md
Created March 4, 2019 20:57 — forked from Vestride/encoding-video.md
Encoding video for the web

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 / ffmpeg-web-video-guide.md
Created March 4, 2019 21:00 — forked from jaydenseric/ffmpeg-web-video-guide.md
A quick guide to using FFmpeg to create cross-device web videos.

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 / __init.py__
Last active October 13, 2019 23:54
pyTelegramBotAPI + webhooks + Azure Function
# 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 / closestStraightCity.js
Last active October 14, 2019 19:59
BOLT nearest neighbour
// 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],...}
// }
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 / vue-test-utils.d.ts
Created May 26, 2020 21:10
vue-test-utils: improve types for typed wrapper.setProps()
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>
}
const fs = require('fs')
const SVGO = require('svgo')
const svgo = new SVGO({
plugins: [
{ removeXMLNS: true },
{ sortAttrs: true },
{ removeDimensions: true },
],
@voskresla
voskresla / gist:c89266d7e64618c123cd506e9130929c
Last active August 5, 2020 14:24
Shopify link-product-options-in-menus Brooklyn Theme
<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
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)
*