Skip to content

Instantly share code, notes, and snippets.

View Loskir's full-sized avatar
:bowtie:

Kirill Loskutov Loskir

:bowtie:
View GitHub Profile
@Loskir
Loskir / esbuild.mjs
Created July 23, 2023 19:15
Using esbuild to build a node.js project
import { build } from 'esbuild'
import { glob } from 'glob'
import { rimraf } from 'rimraf'
async function main() {
console.time('build')
await rimraf('./dist')
const globOptions = { ignore: ['node_modules/**', 'dist/**'] }
const files = await glob('**/*.{js,ts,json}', globOptions)
await build({
const yaml = require('js-yaml')
const fs = require('fs')
const path = require('path')
function* getDotPaths(data) {
function* iter(obj, parentPaths) {
for (const [k, v] of Object.entries(obj)) {
const p = [...parentPaths, k]
if (typeof v === 'object' && v !== null) {
yield* iter(v, p)
@Loskir
Loskir / vscode.css
Last active July 24, 2022 14:26
Custom styles for vscode: compact tabs, better wrapping
:root {
--tab-height: 28px;
}
.tabs-container {
height: auto;
}
.tabs-container .tab,
.tabs-container .monaco-icon-label,
@Loskir
Loskir / af-magic.zsh-theme
Created June 6, 2022 22:22
Loskir's fork of af-magic theme
# af-magic.zsh-theme
# Repo: https://github.com/andyfleming/oh-my-zsh
# Direct Link: https://github.com/andyfleming/oh-my-zsh/blob/master/themes/af-magic.zsh-theme
# Changed by Loskir
# settings
typeset +H return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
typeset +H my_gray="$FG[237]"
typeset +H my_orange="$FG[214]"
@Loskir
Loskir / noMangleGoogle.user.js
Last active December 23, 2021 10:08 — forked from radiantly/noMangleGoogle.user.js
Prevent Google from mangling links on the search results when clicking or copying on Firefox
// ==UserScript==
// @name Prevent link mangling on Google and Yandex
// @namespace LordBusiness.LMG
// @match https://www.google.com/search
// @match https://yandex.ru/search*
// @version 1.2
// @author radiantly
// @description Prevent Google and Yandex from mangling the link when copying or clicking the link
// ==/UserScript==
@Loskir
Loskir / blockDetection.js
Created June 12, 2021 15:01
Telegraf v3 middleware for handling block/unblock events
const Events = require('../models/events')
const Users = require('../models/users')
module.exports = async (ctx, next) => {
if (ctx.update?.my_chat_member?.chat?.type !== 'private') {
return next()
}
if (!ctx.update?.my_chat_member?.new_chat_member?.status) {
return next()
}