Skip to content

Instantly share code, notes, and snippets.

View smashercosmo's full-sized avatar

Vladislav Shkodin smashercosmo

View GitHub Profile
@smashercosmo
smashercosmo / create-mock-pull-request.ts
Created September 17, 2026 10:57
Create mock pull request
import child_process from "node:child_process";
export function createMockPullRequest({
repo,
branch,
number,
}: {
repo: string;
branch: string;
number: number;
@smashercosmo
smashercosmo / create-mock-git-repo.ts
Created September 17, 2026 10:56
Create mock git repo
import { execSync } from "node:child_process";
import fs from "node:fs";
import path from "node:path";
import { RELEASE_BRANCH_NAME, FEATURE_BRANCH_NAME } from "../actrc";
import os from 'node:os'
const monorepoRoot = execSync("git rev-parse --show-toplevel", {
encoding: "utf8",
}).trim();
.root {
--dc-button-color: inherit;
--dc-button-border-color: inherit;
--dc-button-background-color: inherit;
--dc-button-icon-size: inherit;
--dc-button-gap: inherit;
--dc-button-block-size: inherit;
--dc-button-inline-size: inherit;
--dc-button-content-inline-size: inherit;
--dc-button-padding-block: inherit;
@smashercosmo
smashercosmo / Dockerfile
Last active August 18, 2026 17:36
my devcontainer
FROM debian:bookworm-slim
# 1. Install JetBrains requirements, zsh, and Node dependencies (libatomic1)
RUN apt-get update && apt-get install -y --no-install-recommends \
curl ca-certificates git zsh procps unzip tar libatomic1 \
&& rm -rf /var/lib/apt/lists/*
# 2. Create the non-root user
RUN useradd -m -u 1000 -s /bin/zsh developer
@smashercosmo
smashercosmo / extractor.ts
Created September 12, 2025 17:24
Extended attributify extractor for unocss
import { type Extractor } from "unocss";
const SPACES = String.raw`\s*`;
const COMPONENT_NAME = `[a-zA-Z][a-zA-Z]*`;
const ATTRIBUTE_NAME = `[a-zA-Z][-a-zA-Z:]*`;
const DOUBLE_QUOTE_ATTRIBUTE_VALUE = `"[^"]*?"`;
const SINGLE_QUOTE_ATTRIBUTE_VALUE = `'[^']*?'`;
const EXPRESSION_ATTRIBUTE_VALUE = `{${SPACES}.*?${SPACES}}`;
const ATTRIBUTE_VALUE = `
(?:
@smashercosmo
smashercosmo / NotAffectingLineHeightObject.module.css
Created March 2, 2025 12:48
Any object wrapped in this component stops affecting line-height
.root {
display: inline-flex;
}
.object {
display: inline-grid;
grid-template-rows: 0;
align-items: center;
align-self: center;
}
function Form() {
const { control } = useForm({
defaultValues: {
name: "",
};
});
return (
<form>
<SharedInput control={control} name="name" />
</form>
@smashercosmo
smashercosmo / Architecture.md
Last active February 26, 2024 02:19
Welcome file

Frontend architecture for Tasks application

This document describes frontend architecture for a SaaS system to manage tasks. It covers infrastructure, tech stack, viable approaches to fulfill certain requirements and desirable API.

Overview of the architecture

Infrastructure

Vite bundler (which is basically an industry standard nowadays) is going to be used for bundling, code splitting and live reloading during development. Another two industry standards - ESLint and Prettier - are going to be used for linting and formatting correspondingly. We can also setup pre-commit hooks via Husky and lint-staged libraries to ensure that no linting, formatting or type errors slip through. The app will be written in TypeScript, which helps to reduce the number of runtime errors and also makes refactoring easier.

Framework

@smashercosmo
smashercosmo / handler.js
Created March 9, 2023 22:27
Extract tmdb ids
let got = require('got')
let zlib = require('zlib')
let os = require('os')
module.exports.getIds = function getIds(event, context, callback) {
  let unzip = zlib.createGunzip()
  /* TODO url should be constructed based on the current date */
  let stream = got.stream('https://files.tmdb.org/p/exports/movie_ids_01_22_2020.json.gz', )
  stream.pipe(unzip)

# Random notes on tmdb

- Current tmdb rate limit is 40 requests for every 10 seconds - Records (movies, people, etc.) in tmdb can be removed (either by accident or on purpose) - Possible reasons for removal: record is a duplicate, record violates contributing guidelines - If there are duplicate records then the earliest one will be kept (though not always https://www.themoviedb.org/talk/5c6afe320e0a2617779a93d3#5c6b3120c3a3684fabe720c5) - If a movie was removed accidentally, it won't be restored under the same id https://www.themoviedb.org/talk/5bb44d2c0e0a261a17008fc2#5bb507299251415b64002578 - The old id is gone forever and won't be reused - There is no way to determine new id for a movie if it was replaced by a new record (I assume it can only be handled manually) https://www.themoviedb.org/talk/5b4dca43c3a36823d8049f42 (but this might be solved in future https://trello.com/c/Dgrb7BJQ/125-store-the-original-merged-to-ids-when-a-duplicate-is-deleted) - Lists