Skip to content

Instantly share code, notes, and snippets.

View wmakeev's full-sized avatar
💭
💻

Makeev Vitaliy wmakeev

💭
💻
View GitHub Profile
@wmakeev
wmakeev / resolve.ts
Created March 17, 2022 09:15
[Error helpers] #error #resolve
export const resolve = async <T>(promise: Promise<T>) => {
try {
const result = await promise
return [result, null] as const
} catch (err) {
if (err instanceof Error) {
return [null, err] as const
} else {
throw err
}
@wmakeev
wmakeev / errors.ts
Created March 20, 2022 11:35
[Custom errors] #error #typescript
export class SomeError extends Error {
constructor(message: string) {
super(message)
this.name = this.constructor.name
/* istanbul ignore else */
if (Error.captureStackTrace) {
Error.captureStackTrace(this, this.constructor)
}
}
}
@wmakeev
wmakeev / moysklad-kassa-fix.md
Last active March 30, 2022 13:22
[Исправление ошибки Кассы МойСклад на Ubuntu 20+] #moysklad #kassa #ubuntu

Исправление ошибки запуска кассы МойСклад на Ubuntu 20+

Описание ошибки

После установки кассы МойСклад, приложение не запускается. При попытке запустить кассу через командную строку получаем следующую ошибку:

$ moysklad-kassa

(moysklad-kassa:28133): Pango-ERROR **: 17:41:02.913: Harfbuzz version too old (1.3.1)
@wmakeev
wmakeev / canon-mf4010-linux.md
Last active March 30, 2022 14:56
[Canon MF4010 Linux driver] #canon #mf4010

Установка принтера Canon MF4010

  1. Скачать Драйвер принтера UFR II/UFRII LT для Linux V5.40
  2. Распаковать и запустить sudo ./install.sh
  3. Далее выбрать модель принтера (регистрация принтера) и завершить установку

В самом начале был установлен Драйвер CQue DEB (не знаю нужен ли он по факту)

@wmakeev
wmakeev / linux_config_tips.md
Last active December 24, 2022 10:51
[Linux config tips] #linux

Apple 101 keyboard setup

  • Functional keys fix

    echo "options hid_apple fnmode=2" | sudo tee /etc/modprobe.d/hid_apple.conf
  • System settings > Layouts > Options

@wmakeev
wmakeev / Ozon.ts
Last active June 2, 2022 04:01
[OZON API wrapper] #ozon #api #marketplace
/*
# CHANGELOG:
- 2022-06-02 initial
*/
import type { fetch, FetchOptions } from "../tools/fetch-adapter";
export interface OzonOptions {
clientId: string;
@wmakeev
wmakeev / README.md
Last active January 24, 2023 12:46
[Yandex.Cloud] #yandex #cloud #trigger #type
@wmakeev
wmakeev / package.json
Last active November 13, 2023 06:31
[01 - Node.js ESM] #template #esm #node
{
"name": "example",
"version": "1.0.0",
"type": "module",
"description": "",
"exports": "./src/index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"engines": {
@wmakeev
wmakeev / getDocumentsStream.js
Last active January 24, 2023 13:38
[МойСклад - entity streams] #moysklad #stream #generator
/**
* Возвращает товары способом обычного листания
*
* @param {import('moysklad').Instance} ms
* @param {string} path
* @param {import('moysklad').Query} query
*/
export async function* getDocumentsStream(ms, path, query) {
/** @type {string | undefined} */
let nextHref = ms.buildUrl(path, query)
@wmakeev
wmakeev / GetMoyskladAttr.d.ts
Last active September 6, 2023 11:38
[МойСклад - часто используемые функции] #moysklad #tools #usefull #helpers
type GetMoyskladAttr = <
T extends import("moysklad-api-model").Attribute["type"]
>(
entity: { attributes?: import("moysklad-api-model").Attribute[] },
type: T,
id: string
) => Extract<import("moysklad-api-model").Attribute, { type: T }> | null;