Skip to content

Instantly share code, notes, and snippets.

@medoevruslan
medoevruslan / error-utils.ts
Created January 24, 2024 12:43 — forked from safronman/error-utils.ts
axios catch TS error
import { setAppErrorAC, SetAppErrorActionType } from '../../app/app-reducer';
import { Dispatch } from 'redux';
import axios, { AxiosError } from 'axios';
import { AppThunk } from '../../app/store';
import { packsAPI } from '../../api/packs-api';
export const errorUtils = (e: Error | AxiosError<{error: string}>, dispatch: Dispatch<SetAppErrorActionType>) => {
const err = e as Error | AxiosError<{ error: string }>
if (axios.isAxiosError(err)) {
const error = err.response?.data ? err.response.data.error : err.message
@medoevruslan
medoevruslan / mac-homebrew-lamp.md
Created February 2, 2024 13:48 — forked from kitloong/mac-homebrew-lamp.md
Mac - Install Apache, PHP, MySQL + phpMyAdmin with Homebrew

!!! This guide was created with Macbook Pro M1. Path may vary for different or even same machine.

Install Homebrew

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

Install PHP

@medoevruslan
medoevruslan / GitCommitBestPractices.md
Created March 29, 2024 09:34 — forked from luismts/GitCommitBestPractices.md
Git Tips and Git Commit Best Practices

Git Commit Best Practices

Basic Rules

Commit Related Changes

A commit should be a wrapper for related changes. For example, fixing two different bugs should produce two separate commits. Small commits make it easier for other developers to understand the changes and roll them back if something went wrong. With tools like the staging area and the ability to stage only parts of a file, Git makes it easy to create very granular commits.

Commit Often

Committing often keeps your commits small and, again, helps you commit only related changes. Moreover, it allows you to share your code more frequently with others. That way it‘s easier for everyone to integrate changes regularly and avoid having merge conflicts. Having large commits and sharing them infrequently, in contrast, makes it hard to solve conflicts.

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example