Skip to content

Instantly share code, notes, and snippets.

View develax's full-sized avatar
💭
∑☯

Joe develax

💭
∑☯
View GitHub Profile
@develax
develax / VSCode_Settings.MD
Last active November 12, 2024 08:22
VSCode Settings

VSCode Settings

@develax
develax / TypeScript_Infer.md
Last active September 23, 2024 19:41
TypeScript inferring types

TypeScript infer

Extract String

type ExtractStringType<T> = T extends `${infer U}` ? U : never;
type StrType1 = ExtractStringType<'ABC'>; // 'ABC'
type StrType2 = ExtractStringType<string>; // never
type StrType3 = ExtractStringType<123>; // never

Infer Function Argument Type

A function that accepts an argument of an anonymous type where hobbies is a tuple:

function stringifyPerson(person: {
    name: string;
    age: number;
    hobbies: [string, string]; // tuple
}) {
    return `${person.name} is ${person.age} years old and loves ${person.hobbies.join(" and  ")}.`;
@develax
develax / TypeScript_Unions.md
Last active September 21, 2024 19:26
Unions as type property keys

Unions

Unions as type property keys

type StringKeys = 'firstName' | 'lastName';
type NumberKeys = 'age';

type Person = {
    [Key in StringKeys]: string;

Таксист зарабатывает 3 тысячи рублей в будни и 5 тысяч в выходные. При этом он тратит на еду 1 тысячу в будни, и 1.5 тысячи в выходные. Каждую третью неделю он тратит 2 тысячи на мойку автомобиля. Сколько понадобится времени, чтобы таксист заработал 1 миллион рулей?

Angular (VSCode)

Create new Angular project: ng new AppName

Run the project: ng serve --open (or F5 in VSCode)

Install styles npm install -D tailwindcss

@develax
develax / VSCode_TypeScript_setup.md
Last active May 5, 2024 12:47
VSCode + TypeScript setup

VSCode + TypeScript setup

Set TS version for VSCode intellisence

VS Code command palette: &gt; TypeScript: Select TypeScript version

@develax
develax / 3D-Engine-from-scratch.MD
Last active June 27, 2020 22:02
3D Engine from scratch
@develax
develax / BlenderHotkeys.MD
Last active March 5, 2020 21:41
Blender Hotkeys Cheat Sheet

Blender Hotkyes

UI

COMMAND DESCRIPTION
T Tools Panel (Transform)

Focus / View